Commit 4a792e06 authored by Mariya Podchishchaeva's avatar Mariya Podchishchaeva
Browse files

[clang] Fix new-expression with elaborated-type-specifier

Expressions like
```
struct A {};
...
new struct A {};
struct A* b = (1 == 1) ? new struct A : new struct A;

```
were parsed as redefinitions of `struct A` and failed, however as clarified by
`CWG2141` new-expression cannot define a type, so both these examples
should be considered as references to the previously declared `struct A`.
The patch adds a "new" kind context for parsing declaration specifiers in
addition to already existing declarator context in order to track that
the parser is inside of a new expression.

Fixes https://github.com/llvm/llvm-project/issues/34341

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D153857
parent fc5a5794
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment