[clang] [Clang] Implement CWG2900 (PR #224291)

Corentin Jabot via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 29 09:55:37 PDT 2026


================
@@ -5566,6 +5566,22 @@ bool Sema::CheckTemplateArgument(NamedDecl *Param, TemplateArgumentLoc &ArgLoc,
     if (NTTP->isParameterPack() && NTTP->isExpandedParameterPack())
       NTTPType = NTTP->getExpansionType(ArgumentPackIndex);
 
+    // C++26 [dcl.type.auto.deduct]p3:
+    //   If the placeholder-type-specifier is of the form type-constraint_opt
+    //   auto, [...] If E is a value synthesized for a constant template
+    //   parameter of type decltype(auto) ([temp.func.order]), the declaration
+    //   is ill-formed.
+    auto isUndeducedAuto = [](QualType T, bool DecltypeAuto) {
+      const AutoType *AT = T->getContainedAutoType();
----------------
cor3ntin wrote:

Yes, i don't think there are cases that can hit the null branch - and if there are, I'd rather we assert than propagate an error.
(notice the `if(NonTypeTemplateParmDecl` above)

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


More information about the cfe-commits mailing list