diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 550b7541d9f..bce9b108723 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2019-03-26 Jason Merrill + PR c++/86932 - missed SFINAE with empty pack. + * pt.c (coerce_template_parms): Don't add an empty pack if + tf_partial. + (fn_type_unification): Pass tf_partial to coerce_template_parms. + PR c++/86429 - constexpr variable in lambda. PR c++/82643 PR c++/87327 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 05d5371d8a6..dc982f3ed55 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -8436,6 +8436,7 @@ coerce_template_parms (tree parms, arg = NULL_TREE; if (template_parameter_pack_p (TREE_VALUE (parm)) + && (arg || !(complain & tf_partial)) && !(arg && ARGUMENT_PACK_P (arg))) { /* Some arguments will be placed in the @@ -20077,7 +20078,7 @@ fn_type_unification (tree fn, substitution context. */ explicit_targs = (coerce_template_parms (tparms, explicit_targs, NULL_TREE, - complain, + complain|tf_partial, /*require_all_args=*/false, /*use_default_args=*/false)); if (explicit_targs == error_mark_node) diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae65.C b/gcc/testsuite/g++.dg/cpp0x/sfinae65.C new file mode 100644 index 00000000000..66790df77c6 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae65.C @@ -0,0 +1,15 @@ +// PR c++/86932 +// { dg-do compile { target c++11 } } + +template struct enable_if { using type = T; }; +template struct enable_if { }; + +template struct is_foo { static constexpr bool value = false; }; + +// { dg-error "enable_if" "" { target *-*-* } .+1 } +template::value, int>::type...> void f() {} + +int main() +{ + f(); // { dg-error "no match" } +}