https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83937

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Actually this might be just a missing TARGET_EXPR_DIRECT_INIT_P check in
build_special_member_call:

--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -8824,7 +8824,8 @@ build_special_member_call (tree instance, tree name,
vec<tree, va_gc> **args,
    arg = perform_implicit_conversion_flags (class_type, arg,
                         sub_complain,
                         flags);
-      if ((TREE_CODE (arg) == TARGET_EXPR
+      if (((TREE_CODE (arg) == TARGET_EXPR
+       && TARGET_EXPR_DIRECT_INIT_P (arg))
       || TREE_CODE (arg) == CONSTRUCTOR)
      && (same_type_ignoring_top_level_qualifiers_p
          (class_type, TREE_TYPE (arg))))

Reply via email to