@@ -224,13 +224,7 @@ lvalue_kind (const_tree ref)
return lvalue_kind (BASELINK_FUNCTIONS (CONST_CAST_TREE (ref)));
case NON_DEPENDENT_EXPR:
- /* We just return clk_ordinary for NON_DEPENDENT_EXPR in C++98, but
- in C++11 lvalues don't bind to rvalue references, so we need to
- work harder to avoid bogus errors (c++/44870). */
- if (cxx_dialect < cxx11)
- return clk_ordinary;
- else
- return lvalue_kind (TREE_OPERAND (ref, 0));
+ return lvalue_kind (TREE_OPERAND (ref, 0));
default:
if (!TREE_TYPE (ref))
@@ -6275,10 +6275,8 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2,
{
tree min = build_min_non_dep (COND_EXPR, expr,
orig_ifexp, orig_op1, orig_op2);
- /* In C++11, remember that the result is an lvalue or xvalue.
- In C++98, lvalue_kind can just assume lvalue in a template. */
- if (cxx_dialect >= cxx11
- && lvalue_or_rvalue_with_address_p (expr)
+ /* Remember that the result is an lvalue or xvalue. */
+ if (lvalue_or_rvalue_with_address_p (expr)
&& !lvalue_or_rvalue_with_address_p (min))
TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min),
!real_lvalue_p (expr));
new file mode 100644
@@ -0,0 +1,21 @@
+// PR c++/70610
+// { dg-do link }
+
+struct A { };
+
+void operator+ (const A &, A &);
+void operator+ (A &, const A &);
+void operator+ (const A &, const A &) { }
+
+template <typename T>
+void
+foo ()
+{
+ A () + A ();
+}
+
+int
+main ()
+{
+ foo<int> ();
+}
new file mode 100644
@@ -0,0 +1,21 @@
+// PR c++/70610
+// { dg-do link }
+
+void bar (const int &, int &);
+void bar (int &, const int &);
+void bar (const int &, const int &) { }
+
+int a, b;
+
+template <typename T>
+void
+foo ()
+{
+ bar (a + 1, b + 2);
+}
+
+int
+main ()
+{
+ foo<int> ();
+}
new file mode 100644
@@ -0,0 +1,19 @@
+// PR c++/70610
+// { dg-do link }
+
+struct A { void operator+ (const A &) { }; };
+
+void operator+ (const A &, A &);
+
+template <typename T>
+void
+foo ()
+{
+ A () + A ();
+}
+
+int
+main ()
+{
+ foo<int> ();
+}
new file mode 100644
@@ -0,0 +1,21 @@
+// PR c++/70610
+// { dg-do link }
+
+struct A { };
+
+void operator+ (A &);
+void operator+ (const A &) { }
+
+
+template <typename T>
+void
+foo ()
+{
+ +A ();
+}
+
+int
+main ()
+{
+ foo<int> ();
+}