[clang] [Sema] Add check for bitfield assignments to larger integral types (PR #68276)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 6 06:37:57 PDT 2023


================
@@ -0,0 +1,36 @@
+// RUN: %clang_cc1 -Wconversion -fsyntax-only -verify %s
+
+typedef struct _xx {
+     int bf:9; // expected-note{{widen this field to 32 bits to store all values of 'int'}}
+     // expected-note at -1{{widen this field to 16 bits to store all values of 'short'}}
----------------
erichkeane wrote:

I'm questioning the usefulness of the usefulness of this note like this.  

I think it:
1- should point to the RHS expression of the assignment.  
2- Should instead refer to the expression itself (particularly since the one online 7 has the different amount of bits).

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


More information about the cfe-commits mailing list