Commit 0968003d by Marek Polacek Committed by Marek Polacek

PR c++/91819 - ICE with operator++ and enum.

	* call.c (build_new_op_1): Set arg2_type.

	* g++.dg/other/operator4.C: New test.

From-SVN: r276027
parent dcb786e5
2019-09-22 Marek Polacek <polacek@redhat.com>
PR c++/91819 - ICE with operator++ and enum.
* call.c (build_new_op_1): Set arg2_type.
2019-09-17 Jason Merrill <jason@redhat.com>
* parser.c (cp_parser_statement): Handle [[likely]] on
......
......@@ -5878,7 +5878,10 @@ build_new_op_1 (const op_location_t &loc, enum tree_code code, int flags,
goto builtin;
if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
arg2 = integer_zero_node;
{
arg2 = integer_zero_node;
arg2_type = integer_type_node;
}
vec_alloc (arglist, 3);
arglist->quick_push (arg1);
......
2019-09-22 Marek Polacek <polacek@redhat.com>
PR c++/91819 - ICE with operator++ and enum.
* g++.dg/other/operator4.C: New test.
2019-09-21 Martin Sebor <msebor@redhat.com>
PR middle-end/91830
......
// PR c++/91819 - ICE with operator++ and enum.
// { dg-do compile }
enum Foo
{
a,
b
};
inline Foo operator++(Foo &f, int)
{
return f = (Foo)(f + 1);
}
int main()
{
int count = 0;
for (Foo f = a; f <= b; f++) {
count++;
}
return count;
}
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