From 2ee1fce9fc35de21b28823ccae433c90a0ce270b Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 14 May 2025 10:23:32 -0400 Subject: [PATCH] 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. --- 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; -- 2.47.2