2016-03-03 Jason Merrill <jason@redhat.com>
+ PR c++/51406
+ * typeck.c (build_static_cast_1): Avoid folding back to lvalue.
+
PR c++/67364
* constexpr.c (cxx_eval_component_reference): Just return an empty
CONSTRUCTOR for an empty class.
tree lref = cp_build_reference_type (TREE_TYPE (type), false);
result = (perform_direct_initialization_if_possible
(lref, expr, c_cast_p, complain));
- result = cp_fold_convert (type, result);
- /* Make sure we don't fold back down to a named rvalue reference,
- because that would be an lvalue. */
- if (DECL_P (result))
- result = build1 (NON_LVALUE_EXPR, type, result);
+ result = build1 (NON_LVALUE_EXPR, type, result);
return convert_from_reference (result);
}
else