[clang] [Clang] Fix a partial ordering bug involving CTAD injected template arguments (PR #149782)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 21 10:19:49 PDT 2025


================
@@ -5525,6 +5525,8 @@ static TemplateDeductionResult CheckDeductionConsistency(
   // FIXME: A substitution can be incomplete on a non-structural part of the
   // type. Use the canonical type for now, until the TemplateInstantiator can
   // deal with that.
+  if (auto *Injected = P->getAs<InjectedClassNameType>())
+    P = Injected->getInjectedSpecializationType();
----------------
mizvekov wrote:

It's not immediately clear to me these injected class template types only appear at the top level type of the parameters, that they can't appear nested within, and there is no explanation for that.

If we can't fix this at the deduction guide level, I think the next best thing would be to make sure the substitution here produces the right injected vs non-injected type to match the other side, by manipulating the current context.

https://github.com/llvm/llvm-project/pull/149782


More information about the cfe-commits mailing list