]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: one more PR99599 tweak
authorJason Merrill <jason@redhat.com>
Wed, 14 May 2025 14:23:32 +0000 (10:23 -0400)
committerJason Merrill <jason@redhat.com>
Thu, 15 May 2025 14:30:56 +0000 (10:30 -0400)
Patrick pointed out that if the parm/arg types aren't complete yet at this
point, it would affect the type_has_converting_constructor and
TYPE_HAS_CONVERSION tests.  I don't have a testcase, but it makes sense for
safety.

PR c++/99599

gcc/cp/ChangeLog:

* pt.cc (conversion_may_instantiate_p): Make sure
classes are complete.

gcc/cp/pt.cc

index 0d64a1cfb1280cff50686c1ecf5e9060c441f38d..e0857fc26d07003451c918cc07441c9eef605eea 100644 (file)
@@ -23529,13 +23529,13 @@ conversion_may_instantiate_p (tree to, tree from)
 
   /* Converting to a non-aggregate class type will consider its
      user-declared constructors, which might induce instantiation.  */
-  if (CLASS_TYPE_P (to)
+  if (CLASS_TYPE_P (complete_type (to))
       && type_has_converting_constructor (to))
     return true;
 
   /* Similarly, converting from a class type will consider its conversion
      functions.  */
-  if (CLASS_TYPE_P (from)
+  if (CLASS_TYPE_P (complete_type (from))
       && TYPE_HAS_CONVERSION (from))
     return true;