[clang] [clang] Fix -Wdouble-promotion in C++ list-initialization (PR #159992)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 24 08:36:51 PDT 2025
================
@@ -12909,7 +12909,19 @@ static void AnalyzeImplicitConversions(
// Skip past explicit casts.
if (auto *CE = dyn_cast<ExplicitCastExpr>(E)) {
- E = CE->getSubExpr()->IgnoreParenImpCasts();
+ E = CE->getSubExpr();
+ // In the special case of C++ function-style cast with braces,
+ // CXXFunctionalCastExpr has InitListExpr as direct child with a single
+ // initializer. This InitListExpr basically belongs to the cast itself, so
+ // we skip it too. Specifically this is needed to silence -Wdouble-promotion
----------------
Sirraide wrote:
```suggestion
// In the special case of a C++ function-style cast with braces,
// CXXFunctionalCastExpr has an InitListExpr as direct child with a single
// initializer. This InitListExpr basically belongs to the cast itself, so
// we skip it too. Specifically this is needed to silence -Wdouble-promotion
```
nit
https://github.com/llvm/llvm-project/pull/159992
More information about the cfe-commits
mailing list