[PATCH] D134128: Resubmit an implemention for constrained template template parameters [P0857R0 Part B]

Liming Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 18 06:05:16 PDT 2022


lime added a comment.

In D134128#3798127 <https://reviews.llvm.org/D134128#3798127>, @cor3ntin wrote:

> Thanks for working on this.
> I'll be honest though, I still have absolutely no understanding what the use cases or intents of this features are. I think we were waiting for core to clarify and I'm not sure they did.
> This does seem to implement the wording though...

Perhaps, the intents of this feature are a little confusing, so I add `S5` in the file `p3-2a.cpp`. If it was necessary to check the constains on the template template parameter, we could expect an error there.

But one intent might be a mend of the tailing syntax about constains, as a template parameter like `template <C> typename` is already accepted by Clang.



================
Comment at: clang/lib/Parse/ParseTemplate.cpp:882
 ///         'typename'       [C++1z]
-NamedDecl *
-Parser::ParseTemplateTemplateParameter(unsigned Depth, unsigned Position) {
+///       template-head:     [C++2a]
+///         'template' '<' template-parameter-list '>'
----------------
This is copied from `Parser::ParseTemplateDeclarationOrSpecialization`.


================
Comment at: clang/lib/Parse/ParseTemplate.cpp:909
+      }
+    }
   }
----------------
It is fine to skip the check for the language option of C++20. The parser will emit an error here and complain the lack of `class` or `typename`, if the option is not provided.


================
Comment at: clang/test/CXX/temp/temp.arg/temp.arg.template/p3-2a.cpp:36
+
+template<template<typename T> requires C<T> class P> struct S4 { }; // expected-note 2{{'P' declared here}}
+
----------------
Test whether Clang behaves the same here as it is on `S1`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134128/new/

https://reviews.llvm.org/D134128



More information about the cfe-commits mailing list