[PATCH] D154290: [Clang] Implement P2741R3 - user-generated static_assert messages

Sergei Barannikov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 12 01:35:48 PDT 2023


barannikov88 added inline comments.


================
Comment at: clang/lib/AST/ExprConstant.cpp:16413
+    APSInt C = Char.getInt();
+    Result.push_back(static_cast<char>(C.getExtValue()));
+    if (!HandleLValueArrayAdjustment(Info, PtrExpression, String, CharTy, 1))
----------------
aaron.ballman wrote:
> barannikov88 wrote:
> > This relies on host's CHAR_BIT >= target's CHAR_BIT, which isn't true for my target. Could you add an assertion?
> > 
> Wouldn't adding the assertion cause you problems then? (FWIW, we only support `CHAR_BIT == 8` currently.)
It will, the assertion will help find this place.
There are several places where it is asserted, and this was very helpful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154290



More information about the cfe-commits mailing list