aaron.ballman added inline comments.

================
Comment at: clang/lib/Sema/SemaChecking.cpp:11656
+  IsListInit =
+      IsListInit || (isa<InitListExpr>(OrigE) && S.getLangOpts().CPlusPlus);
+
----------------
ziangwan wrote:
> aaron.ballman wrote:
> > ziangwan wrote:
> > > aaron.ballman wrote:
> > > > Do you want to perform the `isa<>` on `OrigE` or on `E` which has had 
> > > > paren and implicit casts stripped?
> > > When we are dealing with Initialization list syntax expression, the 
> > > out-most expression will be of type `InitListExpr`. Since the out-most 
> > > expression is not `ImplicitCastExpr`, `IgnoreParenImpCasts()` has no 
> > > effect on the `OrigE` object. In other words, `OrigE` and `E` will be the 
> > > same when `isa<InitListExpr>(OrigE)` evaluates to true.
> > > 
> > > In this case, I personally prefer `OrigE` since it is the "non-processed" 
> > > object. However, the rest of the function uses `E` only. I can change it 
> > > to `E`.
> > Ah, I was thinking we had to contend with a case like `({1, 2, 3})` where 
> > there's a `ParenExpr` involved, but I am not certain that's a case we have 
> > to worry about.
> I think `({1,2,3})` is not a valid initializer.
> ```
> implicit-int-float-narrowing.cpp:6:16: warning: expression result unused 
> [-Wunused-value]
>   int a[3] = ({1,2,3});
>                ^
> implicit-int-float-narrowing.cpp:6:18: warning: expression result unused 
> [-Wunused-value]
>   int a[3] = ({1,2,3});
>                  ^
> implicit-int-float-narrowing.cpp:6:21: error: expected ';' after expression
>   int a[3] = ({1,2,3});
>                     ^
> implicit-int-float-narrowing.cpp:6:7: error: array initializer must be an 
> initializer list
>   int a[3] = ({1,2,3});
>       ^
> ```
> If so, I don think we need to worry about there's a `ParenExpr` involved.
> 
Agreed. :-)


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

https://reviews.llvm.org/D64666



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

Reply via email to