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

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 3 10:03:08 PDT 2022


aaron.ballman marked an inline comment as done.
aaron.ballman added inline comments.


================
Comment at: clang/include/clang/Sema/DeclSpec.h:2068
     case DeclaratorContext::TrailingReturnVar:
+    case DeclaratorContext::Association:
       return false;
----------------
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.


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