From: Jason Merrill Date: Sun, 17 Mar 2013 02:38:35 +0000 (-0400) Subject: re PR c++/56039 (ICE in iterative_hash_template_arg, at cp/pt.c:1606) X-Git-Tag: upstream/12.2.0~70839 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8e519a8b0a3543210d7103042cc0a2e1b3603832;p=platform%2Fupstream%2Fgcc.git re PR c++/56039 (ICE in iterative_hash_template_arg, at cp/pt.c:1606) PR c++/56039 * tree.c (strip_typedefs_expr): Complain about lambda, don't abort. From-SVN: r196741 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 739795b..983365c 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2013-03-16 Jason Merrill + PR c++/56039 + * tree.c (strip_typedefs_expr): Complain about lambda, don't abort. + PR c++/54359 * parser.c (cp_parser_direct_declarator): Fix late return for out-of-class defn of member function. diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 6dc33b9..42ba677 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1421,7 +1421,8 @@ strip_typedefs_expr (tree t) } case LAMBDA_EXPR: - gcc_unreachable (); + error ("lambda-expression in a constant expression"); + return error_mark_node; default: break; diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C new file mode 100644 index 0000000..973f8a7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-sfinae1.C @@ -0,0 +1,55 @@ +// PR c++/56039 +// { dg-do compile { target c++11 } } + +template struct BoolSink { typedef void type; }; + +template +struct AddRvalueReferenceImpl { typedef T type; }; + +template +struct AddRvalueReferenceImpl::type> { // { dg-error "lambda" } + typedef T &&type; +}; + +template +struct AddRvalueReference : AddRvalueReferenceImpl { }; + +namespace ImplHelpers { + template + typename AddRvalueReference::type create(void) { } +} + +template +struct IsConstructibleImpl { enum { value = 0 }; }; + +template +struct IsConstructibleImpl() ...); + }>::type, Args ...> { // { dg-error "lambda" } + enum { value = 1 }; +}; + +template +struct IsConstructible : IsConstructibleImpl { }; + +struct DestroyMe { + ~DestroyMe() = delete; +}; + +static_assert(+IsConstructible::value, "error"); +static_assert(!IsConstructible::value, "error"); +static_assert(+IsConstructible::value, "error"); +static_assert(!IsConstructible::value, "error"); +static_assert(!IsConstructible::value, "error"); + +static_assert(+IsConstructible::value, "error"); +static_assert(!IsConstructible::value, "error"); +static_assert(+IsConstructible::value, "error"); + +// { dg-prune-output "expected" } +// { dg-prune-output "does not name a class" } +// { dg-prune-output "static assertion" }