Tested x86_64-pc-linux-gnu, applying to trunk.

-- 8< --

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 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index 0d64a1cfb12..e0857fc26d0 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;
 

base-commit: f28ff1e4f1c91f46d80e26dd77917e47cdd41bbe
-- 
2.49.0

Reply via email to