[Bug c++/109159] [10/11/12/13 Regression] explicit constructor is used in copy-initialization

mpolacek at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Mar 17 21:16:49 GMT 2023


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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This hunk broke it:

@@ -3251,6 +3251,12 @@ add_template_candidate_real (struct z_candidate
**candidates, tree tmpl,
       goto fail;
     }

+  /* Now the explicit specifier might have been deduced; check if this
+     declaration is explicit.  If it is and we're ignoring non-converting
+     constructors, don't add this function to the set of candidates.  */
+  if ((flags & LOOKUP_ONLYCONVERTING) && DECL_NONCONVERTING_P (fn))
+    return NULL;


It doesn't check for BRACE_ENCLOSED_INITIALIZER_P (or some similar flag meaning
we're initializing from an initializer_list) and that's the bug.


More information about the Gcc-bugs mailing list