[clang] [Clang] Fix integer promotion of bit-fields in statement expressions (PR #225597)

ahmed mohamed kamel via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 07:40:18 PDT 2026


================
@@ -7,3 +7,12 @@ void stmtexprs(int i) {
   // expected-warning at +1 {{assumption is ignored because it contains (potential) side-effects}}
   __builtin_assume( ({ if (i) ({ stmtexpr_fn(); }); 1; }) );
 }
+
+struct S {
+  unsigned b : 3;
+};
+
+void test_bitfield_promotion(struct S s) {
+  _Static_assert(_Generic(+({ s.b; }), int: 1, unsigned: 2) == 1,
----------------
AhmedKamel10 wrote:

Added the tests and verified everything is passing.

https://github.com/llvm/llvm-project/pull/225597


More information about the cfe-commits mailing list