Commit 46ab17db by Patrick Palka

Fix PR c++/68978 (bogus error: lvalue required as left operand of assignment)

gcc/cp/ChangeLog:

	PR c++/68978
	* tree.c (lvalue_kind) [MODOP_EXPR]: New case.

gcc/testsuite/ChangeLog:

	PR c++/68978
	* g++.dg/template/pr68978.C: New test.

From-SVN: r231841
parent a49de7a4
2015-12-18 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/68978
* tree.c (lvalue_kind) [MODOP_EXPR]: New case.
2015-12-18 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/67592
......
......@@ -185,6 +185,12 @@ lvalue_kind (const_tree ref)
op2_lvalue_kind = lvalue_kind (TREE_OPERAND (ref, 2));
break;
case MODOP_EXPR:
/* We expect to see unlowered MODOP_EXPRs only during
template processing. */
gcc_assert (processing_template_decl);
return clk_ordinary;
case MODIFY_EXPR:
case TYPEID_EXPR:
return clk_ordinary;
......
2015-12-18 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/68978
* g++.dg/template/pr68978.C: New test.
2015-12-18 Jakub Jelinek <jakub@redhat.com>
PR debug/68860
......
// PR c++/68978
int i = 0, c = 0, radix = 10, max = 0x7fffffff;
template <typename T> int toi_1() {
if (max < ((i *= radix) += c))
return 0;
return i;
}
template <typename T> int toi_2() {
if (max < ((i = radix) = c))
return 0;
return i;
}
template <typename T> int toi_3() {
if (max < ((i = radix) += c))
return 0;
return i;
}
template <typename T> int toi_4() {
if (max < ((i += radix) = c))
return 0;
return i;
}
template <typename T> int toi_5() {
if (max < (((i = radix) += (c += 5)) *= 30))
return 0;
return i;
}
int x = toi_1<int> ();
int y = toi_2<int> ();
int z = toi_3<int> ();
int w = toi_4<int> ();
int r = toi_5<int> ();
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