[PATCH] D153857: [clang] Fix new-expression with elaborated-type-specifier
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 27 09:59:56 PDT 2023
aaron.ballman added a comment.
Thank you for the fix! Just to clarify some things before diving into the review too much... From the patch summary:
Expressions like
new struct A {};
struct A* b = (1 == 1) ? new struct A : new struct A;
Were parsed as definitions of struct A and failed, however as clarified by
CWG2141 new-expression cannot define a type, so both these examples
should be considered as valid.
There's a typo there -- the `new struct A{};` bit should be `struct A {};` (dropping the `new`), right?
I think the root cause of that issue is that we don't implement DR2141 (https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2141); are you intending to cover that DR? If so, there should be tests added to clang/test/CXX/drs/dr21xx.cpp.
================
Comment at: clang/include/clang/Parse/Parser.h:2221
+ DSC_association, // A _Generic selection expression's type association
+ DSC_new // C++ new operator
};
----------------
Adding the comma so the next person doesn't have to, and realigning to the usual indentation
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153857/new/
https://reviews.llvm.org/D153857
More information about the cfe-commits
mailing list