[PATCH] D110641: Implement P0857R0 -Part B: requires clause for template-template params
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 30 09:13:26 PDT 2021
aaron.ballman added inline comments.
================
Comment at: clang/lib/Parse/ParseTemplate.cpp:876
+/// In C++20:
+/// template-head: [C++ temp.pre]
+/// template '<' template-parameter-list '>' requires-clause[opt]
----------------
erichkeane wrote:
> aaron.ballman wrote:
> > Rather than duplicate the grammar for each standard revision, I think we usually try to have one grammar section that incorporates all of the changes over the years, like how we added `[C++1z]` on line 873 above. Any appetite for trying to rearrange like that?
> C++20 reworded this to the point that there is very little in common, so i feared that the grammar would be particularly rough here. I tried a merge at one point, and it was just pretty messy (since the productions don't particularly well match between them).
>
> `type-parameter` in particular ends up being messy, since the leading 'template < param list >' was removed from there.
Okay, SGTM then, thanks!
================
Comment at: clang/lib/Parse/ParseTemplate.cpp:923
+ // Skip until the semi-colon or a '}'.
+ SkipUntil(tok::r_brace, StopAtSemi | StopBeforeMatch);
+ TryConsumeToken(tok::semi);
----------------
erichkeane wrote:
> I'm not positive about this skip-until and 'TryConsumeToken' either. The other place we do optional requires clause parsing does this, but the above 'ParseTemplateParameters' does not.
I think we should be skipping until we hit a `>` or `>>` rather than ` }` right? We can recover after we've finished the template template parameter parsing, we don't need to parse to the end of the class.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110641/new/
https://reviews.llvm.org/D110641
More information about the cfe-commits
mailing list