===================================================================
@@ -3140,10 +3140,15 @@ check_bitfield_decl (tree field)
error ("zero width for bit-field %q+D", field);
w = error_mark_node;
}
- else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0
- && TREE_CODE (type) != ENUMERAL_TYPE
- && TREE_CODE (type) != BOOLEAN_TYPE)
- warning (0, "width of %q+D exceeds its type", field);
+ else if (compare_tree_int (w, TYPE_PRECISION (type)) > 0)
+ {
+ if (TREE_CODE (type) == ENUMERAL_TYPE
+ || TREE_CODE (type) == BOOLEAN_TYPE)
+ pedwarn (input_location, OPT_Wpedantic,
+ "width of %q+D exceeds its type", field);
+ else
+ warning (0, "width of %q+D exceeds its type", field);
+ }
else if (TREE_CODE (type) == ENUMERAL_TYPE
&& (0 > (compare_tree_int
(w, TYPE_PRECISION (ENUM_UNDERLYING_TYPE (type))))))
===================================================================
@@ -1,4 +1,5 @@
// PR c++/27505
+// { dg-options "" }
struct s {
bool field:8;
===================================================================
@@ -0,0 +1,11 @@
+// PR c++/19618
+
+struct bset1 {
+ bool bit : 93111; // { dg-error "exceeds" }
+};
+
+enum E {};
+
+struct bset2 {
+ E bit : 93111; // { dg-error "exceeds" }
+};
===================================================================
@@ -1,4 +1,5 @@
// PR c++/30274
+// { dg-options "" }
struct S {
bool x : 4;
===================================================================
@@ -1,5 +1,6 @@
// PR c++/30274
// { dg-do link }
+// { dg-options "" }
struct S {
bool x : 4;
===================================================================
@@ -1,5 +1,6 @@
// PR c++/30274
// { dg-do run }
+// { dg-options "" }
struct S {
bool x : 4;
===================================================================
@@ -1,4 +1,5 @@
// PR c++/30274
+// { dg-options "" }
struct S {
bool x : 4;
===================================================================
@@ -1,4 +1,5 @@
// { dg-do run }
+// { dg-options "" }
// Make sure that bool bitfields promote to int properly.
struct F {