@@ -6968,6 +6968,7 @@ extern tree get_copy_ctor (tree, tsubst_flags_t);
extern tree get_copy_assign (tree);
extern tree get_default_ctor (tree);
extern tree get_dtor (tree, tsubst_flags_t);
+extern tree build_stub_object (tree);
extern tree strip_inheriting_ctors (tree);
extern tree inherited_ctor_binfo (tree);
extern bool base_ctor_omit_inherited_parms (tree);
@@ -12175,7 +12175,7 @@ can_convert (tree to, tree from, tsubst_flags_t complain)
/* implicit_conversion only considers user-defined conversions
if it has an expression for the call argument list. */
if (CLASS_TYPE_P (from) || CLASS_TYPE_P (to))
- arg = build1 (CAST_EXPR, from, NULL_TREE);
+ arg = build_stub_object (from);
return can_convert_arg (to, from, arg, LOOKUP_IMPLICIT, complain);
}
@@ -1793,7 +1793,7 @@ build_stub_type (tree type, int quals, bool rvalue)
/* Build a dummy glvalue from dereferencing a dummy reference of type
REFTYPE. */
-static tree
+tree
build_stub_object (tree reftype)
{
if (!TYPE_REF_P (reftype))
@@ -4175,7 +4175,8 @@ member_p (const_tree decl)
}
/* Create a placeholder for member access where we don't actually have an
- object that the access is against. */
+ object that the access is against. For a general declval<T> equivalent,
+ use build_stub_object instead. */
tree
build_dummy_object (tree type)
@@ -5931,6 +5931,8 @@ cp_build_binary_op (const op_location_t &location,
if (!processing_template_decl)
{
+ if (resultcode == SPACESHIP_EXPR)
+ result = get_target_expr_sfinae (result, complain);
op0 = cp_fully_fold (op0);
/* Only consider the second argument if the first isn't overflowed. */
if (!CONSTANT_CLASS_P (op0) || TREE_OVERFLOW_P (op0))