diff options
author | Jason Merrill <jason@redhat.com> | 2012-09-13 11:14:08 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2012-09-13 11:14:08 -0400 |
commit | 9c7de5c6bc56ced54ec98abb81c3e3fcec4bc10b (patch) | |
tree | ddf15cc5e037bbe09b8d5ead5a4f5a50e0012e42 /gcc | |
parent | afcf5b8e90cde4d5e61785464c3928fb9c965499 (diff) | |
download | gcc-9c7de5c6bc56ced54ec98abb81c3e3fcec4bc10b.zip gcc-9c7de5c6bc56ced54ec98abb81c3e3fcec4bc10b.tar.gz gcc-9c7de5c6bc56ced54ec98abb81c3e3fcec4bc10b.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/semantics.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/constexpr-temp1.C | 9 |
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6d135a3..55b80c8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2012-09-13 Jason Merrill <jason@redhat.com> + 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 a6cdfb5..d19ff1c 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 3b813a3..0820a05 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2012-09-13 Jason Merrill <jason@redhat.com> + 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 0000000..d065436 --- /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) }; +} |