From: Jason Merrill Date: Thu, 11 Jun 2015 15:45:08 +0000 (-0400) Subject: re PR c++/66445 (ICE with lambda in stmt expression in a template) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=133bc698cb8f42e3655fc68fee19c62fd18d98f7;p=gcc.git re PR c++/66445 (ICE with lambda in stmt expression in a template) PR c++/66445 * constexpr.c (potential_constant_expression_1): Handle a DECL_EXPR of TYPE_DECL. From-SVN: r224382 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b6fdc107f6e..23c8deb2283 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2015-06-11 Jason Merrill + PR c++/66445 + * constexpr.c (potential_constant_expression_1): Handle a + DECL_EXPR of TYPE_DECL. + PR c++/66450 * constexpr.c (cxx_eval_store_expression): Avoid messing up outer ctx->ctor. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index af6b39ecaf5..5dc59a47a88 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -4462,6 +4462,11 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, } return false; + case TYPE_DECL: + case TAG_DEFN: + /* We can see these in statement-expressions. */ + return true; + default: if (objc_is_property_ref (t)) return false; diff --git a/gcc/testsuite/g++.dg/ext/stmtexpr18.C b/gcc/testsuite/g++.dg/ext/stmtexpr18.C new file mode 100644 index 00000000000..d9b99bfd265 --- /dev/null +++ b/gcc/testsuite/g++.dg/ext/stmtexpr18.C @@ -0,0 +1,7 @@ +// PR c++/66445 +// { dg-options "" } + +template void foo () +{ + int a = ({ struct A{} b; 42; }); +}