[PATCH] D103611: Correct the behavior of va_arg checking in C++

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 7 11:26:49 PDT 2021


efriedma added inline comments.


================
Comment at: clang/lib/Sema/SemaExpr.cpp:15783
+      // test for typesAreCompatible() will already properly consider those to
+      // be compatible types.
+      if (Context.getLangOpts().CPlusPlus && !PromoteType.isNull() &&
----------------
This explanation doesn't seem right.  Signed and unsigned types are never considered "compatible".

If I'm understanding correctly, the case this code addresses is promotion according to `[conv.prom]`p3: "A prvalue of an unscoped enumeration type whose underlying type is not fixed [...]".  Somehow, the enum ends up with an unsigned underlying type, but we promote to int?  And this doesn't happen in C somehow?


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

https://reviews.llvm.org/D103611



More information about the cfe-commits mailing list