From 42db600dba6adb352854e1eeb909fc3e7a2d892a Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Thu, 16 Jun 2011 18:09:05 -0400 Subject: re PR c++/49229 ([C++0x][SFINAE] ICE with variadics and depending non-type default parameter) PR c++/49229 * pt.c (tsubst_decl) [FUNCTION_DECL]: Handle substitution failure. From-SVN: r175120 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/pt.c | 2 ++ gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp0x/sfinae26.C | 38 +++++++++++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/sfinae26.C (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a8baca2..000a781 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2011-06-16 Jason Merrill + PR c++/49229 + * pt.c (tsubst_decl) [FUNCTION_DECL]: Handle substitution failure. + PR c++/49251 * semantics.c (finish_id_expression): Mark even dependent variables as used. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index ff145a26..1008b3b 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -9548,6 +9548,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t complain) (DECL_TEMPLATE_RESULT (DECL_TI_TEMPLATE (t))), args, complain, in_decl); + if (argvec == error_mark_node) + RETURN (error_mark_node); /* Check to see if we already have this specialization. */ hash = hash_tmpl_and_args (gen_tmpl, argvec); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index cc12e7b..677ac71 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2011-06-16 Jason Merrill + PR c++/49229 + * g++.dg/cpp0x/sfinae26.C: New. + PR c++/49251 * g++.dg/cpp0x/variadic113.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae26.C b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C new file mode 100644 index 0000000..5b8cdd9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C @@ -0,0 +1,38 @@ +// PR c++/49229 +// { dg-options -std=c++0x } + +extern void* enabler; + +template +struct enable_if {}; + +template +struct enable_if { + typedef T type; +}; + +template +struct and_; + +template +struct and_ : B1 {}; + +template +struct is_same { + static constexpr bool value = false; +}; + +template +struct is_same { + static constexpr bool value = true; +}; + +template +struct S { + template...>::value>::type*& = enabler + > + S(U...){} // # +}; + +S s(0); // { dg-error "no match" } -- cgit v1.1