[PATCH] D132568: [clang][Sema] check default argument promotions for printf

YingChi Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 25 09:23:18 PDT 2022


inclyc marked 2 inline comments as done.
inclyc added inline comments.


================
Comment at: clang/lib/AST/FormatString.cpp:367
+        case BuiltinType::Char_U:
+        case BuiltinType::Bool:
+          return Match;
----------------
aaron.ballman wrote:
> Isn't this a match promotion as well? e.g. `printf("%hhd", (_Bool)0);` where the `_Bool` is promoted to `int` but then cast back down to a char type (which seems rather unlikely to be a type confusion issue).
Hmm? `_Bool` just matches `AnyCharTy` perfectly. `MatchPromotion` means the types having **different** length and they can be considered as "partially matched" because of promotions). 

Isn't `_Bool`  and `AnyChar`  here just have the same length?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132568



More information about the cfe-commits mailing list