[PATCH] D156054: [Clang][Sema] DR722 (nullptr and varargs) and missing -Wvarargs diagnostics

Joshua Cranmer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 14:18:14 PDT 2023


jcranmer-intel added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:17317-17319
+    if (TInfo->getType()->isSpecificBuiltinType(BuiltinType::Float) ||
+        TInfo->getType()->isSpecificBuiltinType(BuiltinType::Half))
       PromoteType = Context.DoubleTy;
----------------
aaron.ballman wrote:
> Hmmm... the existing code seems wrong to me because it's not paying any attention to `FLT_EVAL_METHOD`, but I think it probably should? CC @jcranmer-intel @zahiraam for opinions.
> 
> Actually, I wonder if the correct approach here is to split `Sema::DefaultArgumentPromotion()` up so that we can calculate what the default argument promoted type is of the expression independent of performing the actual promotion, and call the promotion type calculation logic here?
C23 6.5.2.2p6 [draft N3096] says "trailing arguments that have type `float` are promoted to `double`". `FLT_EVAL_METHOD` shouldn't need to apply here, since it's largely about reflecting that things like x87 using 80-bit precision internally, and not actual argument passing.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156054



More information about the cfe-commits mailing list