[PATCH] D64666: [Sema] Enable -Wimplicit-float-conversion for integral to floating point precision loss

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 29 10:52:14 PDT 2019

aaron.ballman accepted this revision.
aaron.ballman added a comment.


Comment at: clang/lib/Sema/SemaChecking.cpp:11656
+  IsListInit =
+      IsListInit || (isa<InitListExpr>(OrigE) && S.getLangOpts().CPlusPlus);
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.



More information about the cfe-commits mailing list