[clang] [C23] Select the correct promoted type for a bit-field (PR #89254)

via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 19 05:55:57 PDT 2024


================
@@ -0,0 +1,38 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c23 %s
+
+// GH87641 noticed that integer promotion of a bit-field of bit-precise integer
+// type was promoting to int rather than the type of the bit-field.
+struct S {
+  unsigned _BitInt(7) x : 2;
+  unsigned _BitInt(2) y : 2;
+  unsigned _BitInt(72) z : 28;
----------------
Sirraide wrote:

Is there a reason all of these are unsigned? Maybe adding some tests for signed `_BitInt`s as well might be a good idea—or do we have those already?

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


More information about the cfe-commits mailing list