"anonymous bit-field has negative width (%0)">;
def err_bitfield_has_zero_width : Error<"named bit-field %0 has zero width">;
def err_bitfield_width_exceeds_type_width : Error<
- "width of bit-field %0 (%1 bits) exceeds %select{width|size}2 "
- "of its type (%3 bit%s3)">;
-def err_anon_bitfield_width_exceeds_type_width : Error<
- "width of anonymous bit-field (%0 bits) exceeds %select{width|size}1 "
- "of its type (%2 bit%s2)">;
+ "width of%select{ anonymous|}0 bit-field%select{| %1}0 (%2 bits) exceeds the "
+ "%select{width|size}3 of its type (%4 bit%s4)">;
def err_incorrect_number_of_vector_initializers : Error<
"number of elements must be either one or match the size of the vector">;
if (CStdConstraintViolation || MSBitfieldViolation) {
unsigned DiagWidth =
CStdConstraintViolation ? TypeWidth : TypeStorageSize;
- if (FieldName)
- return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_width)
- << FieldName << toString(Value, 10)
- << !CStdConstraintViolation << DiagWidth;
-
- return Diag(FieldLoc, diag::err_anon_bitfield_width_exceeds_type_width)
- << toString(Value, 10) << !CStdConstraintViolation
- << DiagWidth;
+ return Diag(FieldLoc, diag::err_bitfield_width_exceeds_type_width)
+ << (bool)FieldName << FieldName << toString(Value, 10)
+ << !CStdConstraintViolation << DiagWidth;
}
// Warn on types where the user might conceivably expect to get all
int a : -1; // expected-error{{bit-field 'a' has negative width}}
// rdar://6081627
- int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds width of its type (32 bits)}}
+ int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds the width of its type (32 bits)}}
int c : (1 + 0.25); // expected-error{{integer constant expression must have integer type}}
int d : (int)(1 + 0.25);
int g : (_Bool)1;
// PR4017
- char : 10; // expected-error {{width of anonymous bit-field (10 bits) exceeds width of its type (8 bits)}}
+ char : 10; // expected-error {{width of anonymous bit-field (10 bits) exceeds the width of its type (8 bits)}}
unsigned : -2; // expected-error {{anonymous bit-field has negative width (-2)}}
float : 12; // expected-error {{anonymous bit-field has non-integral type 'float'}}
- _Bool : 2; // expected-error {{width of anonymous bit-field (2 bits) exceeds width of its type (1 bit)}}
- _Bool h : 5; // expected-error {{width of bit-field 'h' (5 bits) exceeds width of its type (1 bit)}}
+ _Bool : 2; // expected-error {{width of anonymous bit-field (2 bits) exceeds the width of its type (1 bit)}}
+ _Bool h : 5; // expected-error {{width of bit-field 'h' (5 bits) exceeds the width of its type (1 bit)}}
};
struct b {unsigned x : 2;} x;
// RUN: %clang_cc1 -fno-rtti -emit-llvm-only -triple i686-pc-win32 -fdump-record-layouts -fsyntax-only -mms-bitfields -verify %s 2>&1
struct A {
- char a : 9; // expected-error{{width of bit-field 'a' (9 bits) exceeds size of its type (8 bits)}}
- int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds size of its type (32 bits)}}
- bool c : 9; // expected-error{{width of bit-field 'c' (9 bits) exceeds size of its type (8 bits)}}
+ char a : 9; // expected-error{{width of bit-field 'a' (9 bits) exceeds the size of its type (8 bits)}}
+ int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds the size of its type (32 bits)}}
+ bool c : 9; // expected-error{{width of bit-field 'c' (9 bits) exceeds the size of its type (8 bits)}}
bool d : 3;
};
int a : -1; // expected-error{{bit-field 'a' has negative width}}
// rdar://6081627
- int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds width of its type (32 bits)}}
+ int b : 33; // expected-error{{width of bit-field 'b' (33 bits) exceeds the width of its type (32 bits)}}
int c : (1 + 0.25); // expected-error{{integer constant expression must have integer type}}
int d : (int)(1 + 0.25);