Commit 41b38772 by Jason Merrill Committed by Jason Merrill

re PR c++/65525 (ICE: sorry, unimplemented: unexpected AST of kind mem_ref…

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
parent ef99b3de
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> 2015-03-25 Marek Polacek <polacek@redhat.com>
PR c++/65558 PR c++/65558
......
...@@ -4395,6 +4395,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, ...@@ -4395,6 +4395,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict,
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
case MEMBER_REF: case MEMBER_REF:
case DOTSTAR_EXPR: case DOTSTAR_EXPR:
case MEM_REF:
binary: binary:
for (i = 0; i < 2; ++i) for (i = 0; i < 2; ++i)
if (!RECUR (TREE_OPERAND (t, i), want_rval)) if (!RECUR (TREE_OPERAND (t, i), want_rval))
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment