[PATCH] D126969: Allow use of an elaborated type specifier in a _Generic association in C++

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 10:08:28 PDT 2022


erichkeane accepted this revision.
erichkeane added inline comments.
This revision is now accepted and ready to land.


================
Comment at: clang/include/clang/Sema/DeclSpec.h:2068
     case DeclaratorContext::TrailingReturnVar:
+    case DeclaratorContext::Association:
       return false;
----------------
aaron.ballman wrote:
> erichkeane wrote:
> > Is this right?  According to the comment, this is 'true'if the identifier is optional or required, but the mayOmitIdentifier, where you are returning 'true' says optional or not allowed?  Does this make identifier 'not allowed' here?
> I believe this is correct -- associations used to be handled the same as type names, and we still want to handle them effectively as type names. The only distinction between an association and a type name is whether it can be a defining type specifier or not (type  name can be, association cannot be).
> 
> This is the function that tests whether you can put an identifier after the type; e.g., `int a` and I think it's logically consistent. May the identifier be omitted? Certainly, it must be. May it have an identifier? Definitely not.
Ok, that sounds right to me as well then. Its a little annoying/confusing I guess that these two functions combine for a bizarre tri-state: "Required/Optional/Not-allowed", and the name of `mayOmitIdentifier` isn't really a good one, since `may I omit` implies the option here...

Either way, not your ball of wax, but thanks for confirming.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126969



More information about the cfe-commits mailing list