From: Jason Merrill Date: Thu, 13 Sep 2012 15:14:08 +0000 (-0400) Subject: re PR c++/53839 ([C++11] internal compiler error: in adjust_temp_type, at cp/semantic... X-Git-Tag: misc/gccgo-go1_1_2~896 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9c7de5c6bc56ced54ec98abb81c3e3fcec4bc10b;p=thirdparty%2Fgcc.git re PR c++/53839 ([C++11] internal compiler error: in adjust_temp_type, at cp/semantics.c:6391) PR c++/53839 * semantics.c (cxx_eval_indirect_ref): If we aren't looking for an address, make sure the value is constant. From-SVN: r191263 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6d135a35b44b..55b80c8c208e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2012-09-13 Jason Merrill + PR c++/53839 + * semantics.c (cxx_eval_indirect_ref): If we aren't looking for an + address, make sure the value is constant. + PR c++/54511 * pt.c (tsubst_decl) [VAR_DECL]: Handle DECL_ANON_UNION_VAR_P. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index a6cdfb568890..d19ff1cfaa9a 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -7474,7 +7474,11 @@ cxx_eval_indirect_ref (const constexpr_call *call, tree t, } if (r == NULL_TREE) - return t; + { + if (!addr) + VERIFY_CONSTANT (t); + return t; + } return r; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3b813a3f0148..0820a05bfd18 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2012-09-13 Jason Merrill + PR c++/53839 + * g++.dg/cpp0x/constexpr-temp1.C: New. + PR c++/54511 * g++.dg/template/anonunion2.C: New. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-temp1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp1.C new file mode 100644 index 000000000000..d06543632703 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-temp1.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++11 } } + +struct A { int i; }; +constexpr A f2 (const A& a) { return a; } +constexpr int f1 (const A &a) { return f2(a).i; } +A g(const A &a) +{ + return { f1(a) }; +}