diff options
author | Jason Merrill <jason@redhat.com> | 2015-03-26 13:58:39 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2015-03-26 13:58:39 -0400 |
commit | 41b38772ccd584a384945c7b1fdd61f4712d9792 (patch) | |
tree | a7ca6ef7953068da0f3154dac01994bcb415372f | |
parent | ef99b3de9f7b97d1a3ab9f3b009c80fe26d16b33 (diff) | |
download | gcc-41b38772ccd584a384945c7b1fdd61f4712d9792.zip gcc-41b38772ccd584a384945c7b1fdd61f4712d9792.tar.gz gcc-41b38772ccd584a384945c7b1fdd61f4712d9792.tar.bz2 |
re PR c++/65525 (ICE: sorry, unimplemented: unexpected AST of kind mem_ref (-std=c++14, ICE: in potential_constant_expression_1, at cp/constexpr.c:4432))
PR c++/65525
* constexpr.c (potential_constant_expression_1): Handle MEM_REF.
From-SVN: r221699
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/constexpr.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/assign1.C | 22 |
3 files changed, 28 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 4ba45d7..e3699f6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2015-03-26 Jason Merrill <jason@redhat.com> + + PR c++/65525 + * constexpr.c (potential_constant_expression_1): Handle MEM_REF. + 2015-03-25 Marek Polacek <polacek@redhat.com> PR c++/65558 diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 37b619d..2f09472 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -4395,6 +4395,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, case ARRAY_RANGE_REF: case MEMBER_REF: case DOTSTAR_EXPR: + case MEM_REF: binary: for (i = 0; i < 2; ++i) if (!RECUR (TREE_OPERAND (t, i), want_rval)) diff --git a/gcc/testsuite/g++.dg/parse/assign1.C b/gcc/testsuite/g++.dg/parse/assign1.C new file mode 100644 index 0000000..c0138c1 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/assign1.C @@ -0,0 +1,22 @@ +// PR c++/65525 + +struct A +{ + int x; + char y; // Actually, short and bool (types smaller than int?) trigger this ICE too + // Also: the problem doesn't occur if you put the smaller type first, e.g. "char x; int y;" + + A(int x) {} // custom ctor needed for ICE +}; + +int main() +{ + A a(0), x(1), y(2); + + x = a; // OK + y = a; // OK + x = y = a; // ICE: sorry, unimplemented: unexpected AST of kind mem_ref + // internal compiler error: in potential_constant_expression_1, at cp/constexpr.c:4432 + + return 0; +} |