* tree.c (glvalue_p): Rename from lvalue_or_rvalue_with_address_p.
* call.c, cp-tree.h, typeck.c: Adjust.
From-SVN: r238181
2016-07-08 Jason Merrill <jason@redhat.com>
+ * tree.c (glvalue_p): Rename from lvalue_or_rvalue_with_address_p.
+ * call.c, cp-tree.h, typeck.c: Adjust.
+
* lambda.c (maybe_add_lambda_conv_op): Fix null object argument.
P0145R2: Refining Expression Order for C++.
If E2 is an xvalue: E1 can be converted to match E2 if E1 can be
implicitly converted to the type "rvalue reference to T2", subject to
the constraint that the reference must bind directly. */
- if (lvalue_or_rvalue_with_address_p (e2))
+ if (glvalue_p (e2))
{
tree rtype = cp_build_reference_type (t2, !real_lvalue_p (e2));
conv = implicit_conversion (rtype,
&& (CLASS_TYPE_P (arg2_type) || CLASS_TYPE_P (arg3_type)
|| (same_type_ignoring_top_level_qualifiers_p (arg2_type,
arg3_type)
- && lvalue_or_rvalue_with_address_p (arg2)
- && lvalue_or_rvalue_with_address_p (arg3)
+ && glvalue_p (arg2) && glvalue_p (arg3)
&& real_lvalue_p (arg2) == real_lvalue_p (arg3))))
{
conversion *conv2;
extern int member_p (const_tree);
extern cp_lvalue_kind real_lvalue_p (const_tree);
extern cp_lvalue_kind lvalue_kind (const_tree);
-extern bool lvalue_or_rvalue_with_address_p (const_tree);
+extern bool glvalue_p (const_tree);
extern bool xvalue_p (const_tree);
extern tree cp_stabilize_reference (tree);
extern bool builtin_valid_in_constant_expr_p (const_tree);
return kind;
}
-/* This differs from real_lvalue_p in that class rvalues are considered
- lvalues. */
+/* This differs from real_lvalue_p in that xvalues are included. */
bool
-lvalue_p (const_tree ref)
-{
- return (lvalue_kind (ref) != clk_none);
-}
-
-/* This differs from real_lvalue_p in that rvalues formed by dereferencing
- rvalue references are considered rvalues. */
-
-bool
-lvalue_or_rvalue_with_address_p (const_tree ref)
+glvalue_p (const_tree ref)
{
cp_lvalue_kind kind = lvalue_kind (ref);
if (kind & clk_class)
return (kind != clk_none);
}
-/* Returns true if REF is an xvalue, false otherwise. */
+/* This differs from glvalue_p in that class prvalues are included. */
+
+bool
+lvalue_p (const_tree ref)
+{
+ return (lvalue_kind (ref) != clk_none);
+}
+
+/* Returns true if REF is an xvalue (the result of dereferencing an rvalue
+ reference), false otherwise. */
bool
xvalue_p (const_tree ref)
/* We need to do this for rvalue refs as well to get the right answer
from decltype; see c++/36628. */
- if (!processing_template_decl && lvalue_or_rvalue_with_address_p (expr))
+ if (!processing_template_decl && glvalue_p (expr))
expr = build1 (NON_LVALUE_EXPR, type, expr);
else if (type != TREE_TYPE (expr))
expr = build_nop (type, expr);
arguments with such a type; just treat it as a pointer. */
else if (TREE_CODE (TREE_TYPE (exp)) == REFERENCE_TYPE
|| SCALAR_TYPE_P (TREE_TYPE (exp))
- || !lvalue_or_rvalue_with_address_p (exp))
+ || !glvalue_p (exp))
{
init_expr = get_target_expr (exp);
exp = TARGET_EXPR_SLOT (init_expr);
&& TREE_CODE (t) != CONSTRUCTOR
&& TREE_CODE (t) != AGGR_INIT_EXPR
&& (SCALAR_TYPE_P (TREE_TYPE (t))
- || lvalue_or_rvalue_with_address_p (t)))
+ || glvalue_p (t)))
{
TREE_OPERAND (init, 1) = stabilize_expr (t, initp);
return true;
tree min = build_min_non_dep (COND_EXPR, expr,
orig_ifexp, orig_op1, orig_op2);
/* Remember that the result is an lvalue or xvalue. */
- if (lvalue_or_rvalue_with_address_p (expr)
- && !lvalue_or_rvalue_with_address_p (min))
+ if (glvalue_p (expr) && !glvalue_p (min))
TREE_TYPE (min) = cp_build_reference_type (TREE_TYPE (min),
!real_lvalue_p (expr));
expr = convert_from_reference (min);
? real_lvalue_p (expr)
: (CLASS_TYPE_P (TREE_TYPE (dst_type))
? lvalue_p (expr)
- : lvalue_or_rvalue_with_address_p (expr)))
+ : glvalue_p (expr)))
/* OK. */;
else
{