ayzhao added inline comments.

================
Comment at: clang/lib/Sema/SemaInit.cpp:6052
+    } else if (S.getLangOpts().CPlusPlus20 && !TopLevelOfInitList)
+      TryOrBuildParenListInitialization(S, Entity, Kind, Args, *this,
+                                        /*VerifyOnly=*/true);
----------------
ayzhao wrote:
> Status update:
> 
> Right now this is causing the following 2 bugs:
> 
> 1. Currently, the below incorrect line of code:
> 
> ```
> int arr[2] = 1;
> ```
> 
> is being incorrectly treated the same as
> 
> ```
> int arr[2](1);
> ```
> 
> 2. The following below correct line of code:
> ```
> int arr[2] = static_cast<int[2]>(1);
> ```
> 
> fails with the error:
> 
> ```
> test-static-cast.cc:1:12: error: static_cast from 'int' to 'int[2]' is not 
> allowed
> int a[2] = static_cast<int[2]>(1);
>            ^~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
> ```
small fix: the incorrect error message for the 2nd bug is:

```
test-static-cast.cc:1:12: error: cannot initialize an array element of type 
'int' with an rvalue of type 'int[2]'
int a[2] = static_cast<int[2]>(1);
           ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129531

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

Reply via email to