PR c++/49812
* typeck.c (cp_build_unary_op) [POSTINCREMENT_EXPR]: Strip cv-quals.
From-SVN: r177479
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.
}
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.
--- /dev/null
+// 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++);
+}