https://gcc.gnu.org/g:2ee1fce9fc35de21b28823ccae433c90a0ce270b

commit r16-651-g2ee1fce9fc35de21b28823ccae433c90a0ce270b
Author: Jason Merrill <ja...@redhat.com>
Date:   Wed May 14 10:23:32 2025 -0400

    c++: one more PR99599 tweak
    
    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.

Diff:
---
 gcc/cp/pt.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 0d64a1cfb128..e0857fc26d07 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -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;

Reply via email to