[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 08:53:51 PDT 2022
aaron.ballman created this revision.
aaron.ballman added reviewers: erichkeane, jyknight, clang-language-wg.
Herald added a project: All.
aaron.ballman requested review of this revision.
Herald added a project: clang.
Currently, Clang accepts this code in C mode (where the tag is required to be used) but rejects it in C++ mode thinking that the association is defining a new type.
void foo(void) {
struct S { int a; };
_Generic(something, struct S : 1);
}
Clang thinks this in C++ because it sees `struct S :` when parsing the class specifier and decides that must be a type definition (because the colon signifies the presence of a base class type). This patch adds a new declarator context to represent a `_Generic` association so that we can distinguish these situations properly.
Fixes #55562
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D126969
Files:
clang/docs/ReleaseNotes.rst
clang/include/clang/Parse/Parser.h
clang/include/clang/Sema/DeclSpec.h
clang/lib/Parse/ParseDecl.cpp
clang/lib/Parse/ParseDeclCXX.cpp
clang/lib/Parse/ParseExpr.cpp
clang/lib/Sema/SemaType.cpp
clang/test/Sema/generic-selection.c
clang/test/SemaCXX/generic-selection.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126969.434038.patch
Type: text/x-patch
Size: 11160 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220603/61761372/attachment.bin>
More information about the cfe-commits
mailing list