aaron.ballman added a comment.

In D153857#4453092 <https://reviews.llvm.org/D153857#4453092>, @aaron.ballman 
wrote:

> 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.

With offline help from @erichkeane and @shafik I realized where my confusion 
came from here. The patch summary presumes `struct A` is already defined in 
order for us to accept those code examples. I was thrown off by the DR and the 
original issue using `struct A {};` as the first relevant line in the code 
example and was thinking there was confusion as to how the DR was resolved.

How about the summary be changed to something along the lines of:

With code like `struct A {}; <and the rest of your example>`, the expressions 
were parsed as redefining `struct A` and failed. However, as clarified by 
CWG2141, new-expression cannot define a type, so both these expressions should 
be considered as valid references to the previously declared `struct A`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153857

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to