================
@@ -1177,13 +1177,40 @@ getRHSTemplateDeclAndArgs(Sema &SemaRef, 
TypeAliasTemplateDecl *AliasTemplate) {
   auto RhsType = AliasTemplate->getTemplatedDecl()->getUnderlyingType();
   TemplateDecl *Template = nullptr;
   llvm::ArrayRef<TemplateArgument> AliasRhsTemplateArgs;
-  if (const auto *TST = RhsType->getAs<TemplateSpecializationType>()) {
+  const auto *TST = RhsType->getAs<TemplateSpecializationType>();
+
+  // The RHS of the alias may name another alias template that can never have
+  // deduction guides of its own, because its defining-type-id is not of the
+  // form
+  //   [typename] [nested-name-specifier] [template] simple-template-id
+  // as required by [over.match.class.deduct]p3. e.g.
+  //   template <typename T>
+  //   using Identity = T;
+  //   template <typename T>
+  //   using C = Identity<Foo<T>>;
+  // Per [temp.alias]p2, Identity<Foo<T>> is equivalent to Foo<T>, so step
+  // through such aliases and derive the deduction guides from the first
+  // template that can actually have them (GH125821).
----------------
Endilll wrote:

I guess when Younan says that GCC implements something, he refers to September 
2012 proposed resolution. Right below it is a section that talks about concerns 
regarding handling of default template arguments.

If you're going to pursue this, I expect to see tests cases for CWG1286 in 
`cwg12xx.cpp`, and in order to write them you'd need to reference wording: you 
can either use September 2012 resolution, or you can come up with your own and 
submit it to be added to CWG1286 filing. Either way I'd like to see some 
discussion of default template argument handling.

If you don't want to get involved in CWG-level discussion of template wording, 
my recommendation is to walk away from this.

https://github.com/llvm/llvm-project/pull/222215
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to