[clang] [clang] CTAD: build aggregate deduction guides for alias templates. (PR #85904)

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 5 07:17:46 PDT 2024


================
@@ -2792,6 +2811,24 @@ void DeclareImplicitDeductionGuidesForTypeAlias(
   } else {
     assert(false && "unhandled RHS type of the alias");
   }
+  return {Template, AliasRhsTemplateArgs};
+}
+
+// Build deduction guides for a type alias template.
+void DeclareImplicitDeductionGuidesForTypeAlias(
+    Sema &SemaRef, TypeAliasTemplateDecl *AliasTemplate, SourceLocation Loc) {
+  if (AliasTemplate->isInvalidDecl())
+    return;
+  auto &Context = SemaRef.Context;
+  // FIXME: if there is an explicit deduction guide after the first use of the
----------------
hokein wrote:

Emitting a diagnostic is an option, but I think it's suboptimal, and it is not trivial to detect such cases. I prefer to fix the issue directly rather than implementing a diagnostic that would eventually be removed.

Do you consider this case to be critical for the clang trunk at the moment? I believe we should fix it before the next clang release, and we still have some time to do so.

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


More information about the cfe-commits mailing list