PR c++/45282
* typeck2.c (build_m_component_ref): Handle prvalue object.
From-SVN: r197130
+2013-03-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/45282
+ * typeck2.c (build_m_component_ref): Handle prvalue object.
+
2013-03-26 Gabriel Dos Reis <gdr@integrable-solutions.net>
* cp-gimplify.c (cp_genericize_r): Use VAR_OR_FUNCTION_DECL_P.
if (TYPE_PTRDATAMEM_P (ptrmem_type))
{
- bool is_lval = real_lvalue_p (datum);
+ cp_lvalue_kind kind = lvalue_kind (datum);
tree ptype;
/* Compute the type of the field, as described in [expr.ref].
return error_mark_node;
/* If the object expression was an rvalue, return an rvalue. */
- if (!is_lval)
+ if (kind & clk_class)
+ datum = rvalue (datum);
+ else if (kind & clk_rvalueref)
datum = move (datum);
return datum;
}
--- /dev/null
+// PR c++/45282
+// { dg-require-effective-target c++11 }
+
+struct A { int i; };
+int A::*ipm = &A::i;
+
+template <class T, class U> class assert_same_type;
+template <class T> class assert_same_type<T,T> { };
+
+assert_same_type<decltype(A().*ipm),int> x2;