aaron.ballman added a comment.

> Currently, if the second argument is "Bool", it will be casted to "int".

That behavior is required by the standard, which is why we give a warning about 
it being undefined behavior due to the promotion. For C, see C2x 7.16.1.1p2 
("If //type// is not compatible with the type of the actual next argument (as 
promoted according to the default argument promotions), the behavior is 
undefined, except for the following cases: ..." and none of the cases apply to 
bool.) and for C++, see https://eel.is/c++draft/cstdarg.syn#1.sentence-4 which 
says the same thing in different words.

You'll see the same kind of UB if you try to use `short` instead of `bool`: 
https://godbolt.org/z/Kz95vbaY4


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136416

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

Reply via email to