Commit 9127e994 by Jason Merrill Committed by Jason Merrill

re PR c++/49812 (strange return type for built-in operator++(int, int))

	PR c++/49812
	* typeck.c (cp_build_unary_op) [POSTINCREMENT_EXPR]: Strip cv-quals.

From-SVN: r177479
parent fcbc2bed
2011-08-05 Jason Merrill <jason@redhat.com>
PR c++/49812
* typeck.c (cp_build_unary_op) [POSTINCREMENT_EXPR]: Strip cv-quals.
PR c++/49983
* parser.c (cp_parser_range_for): Only do auto deduction in
template if the range is non-dependent.
......
......@@ -5220,6 +5220,9 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
}
val = boolean_increment (code, arg);
}
else if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
/* An rvalue has no cv-qualifiers. */
val = build2 (code, cv_unqualified (TREE_TYPE (arg)), arg, inc);
else
val = build2 (code, TREE_TYPE (arg), arg, inc);
......
2011-08-05 Jason Merrill <jason@redhat.com>
PR c++/49812
* g++.dg/overload/rvalue2.C: New.
PR c++/49983
* g++.dg/cpp0x/range-for21.C: New.
......
// PR c++/49812
// The call should choose the second f because i++ is an int rvalue.
template <class T> void f(const volatile T& t) { t.i; }
template <class T> void f(const T&);
int main()
{
volatile int i = 0;
f(i++);
}
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