You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[C] Update the -Wdefault-const-init-unsafe wording (llvm#138266)
This drops the "and is incompatible with C++" phrasing from the
diagnostic unless -Wc++-compat is explicitly passed. This makes the
diagnostic less confusing when it is on by default rather than enabled
because of C++ compatibility concerns
constsvint8_tuninit_const_int8; // expected-warning {{default initialization of an object of type 'const svint8_t' (aka 'const __SVInt8_t') leaves the object uninitialized and is incompatible with C++}};
97
+
constsvint8_tuninit_const_int8; // expected-warning {{default initialization of an object of type 'const svint8_t' (aka 'const __SVInt8_t') leaves the object uninitialized}};
constvolatilesvint8_tuninit_const_volatile_int8; // expected-warning {{default initialization of an object of type 'const volatile svint8_t' (aka 'const volatile __SVInt8_t') leaves the object uninitialized and is incompatible with C++}}
102
+
constvolatilesvint8_tuninit_const_volatile_int8; // expected-warning {{default initialization of an object of type 'const volatile svint8_t' (aka 'const volatile __SVInt8_t') leaves the object uninitialized}}
103
103
104
104
_Atomic svint8_tatomic_int8; // expected-error {{_Atomic cannot be applied to sizeless type 'svint8_t'}}
105
105
__restrictsvint8_trestrict_int8; // expected-error {{requires a pointer or reference}}
cxx-note {{default constructor of 'W' is implicitly deleted because field 'j' of const-qualified type 'const int' would not be initialized}}
35
38
36
39
voidf() {
37
-
structSs1; // unsafe-field-warning {{default initialization of an object of type 'struct S' with const member leaves the object uninitialized and is incompatible with C++}} \
40
+
structSs1; // unsafe-field-warning {{default initialization of an object of type 'struct S' with const member leaves the object uninitialized}} \
41
+
unsafe-field-compat-warning {{default initialization of an object of type 'struct S' with const member leaves the object uninitialized and is incompatible with C++}} \
38
42
cxx-error {{call to implicitly-deleted default constructor of 'struct S'}}
39
43
structSs2= { 0 };
40
44
}
41
45
voidg() {
42
-
structTt1; // unsafe-field-warning {{default initialization of an object of type 'struct T' with const member leaves the object uninitialized and is incompatible with C++}} \
46
+
structTt1; // unsafe-field-warning {{default initialization of an object of type 'struct T' with const member leaves the object uninitialized}} \
47
+
unsafe-field-compat-warning {{default initialization of an object of type 'struct T' with const member leaves the object uninitialized and is incompatible with C++}} \
43
48
cxx-error {{call to implicitly-deleted default constructor of 'struct T'}}
44
49
structTt2= { { 0 } };
45
50
}
@@ -48,13 +53,15 @@ void h() {
48
53
structUu2= { { 0 }, 0 };
49
54
}
50
55
voidx() {
51
-
structVv1; // unsafe-field-warning {{default initialization of an object of type 'struct V' with const member leaves the object uninitialized and is incompatible with C++}} \
56
+
structVv1; // unsafe-field-warning {{default initialization of an object of type 'struct V' with const member leaves the object uninitialized}} \
57
+
unsafe-field-compat-warning {{default initialization of an object of type 'struct V' with const member leaves the object uninitialized and is incompatible with C++}} \
52
58
cxx-error {{call to implicitly-deleted default constructor of 'struct V'}}
53
59
structVv2= { 0 };
54
60
structVv3= { 0, { 0 } };
55
61
}
56
62
voidy() {
57
-
structWw1; // unsafe-field-warning {{default initialization of an object of type 'struct W' with const member leaves the object uninitialized and is incompatible with C++}} \
63
+
structWw1; // unsafe-field-warning {{default initialization of an object of type 'struct W' with const member leaves the object uninitialized}} \
64
+
unsafe-field-compat-warning {{default initialization of an object of type 'struct W' with const member leaves the object uninitialized and is incompatible with C++}} \
58
65
cxx-error {{call to implicitly-deleted default constructor of 'struct W'}}
59
66
structWw2= { 0 };
60
67
structWw3= { { 0 }, 0 };
@@ -72,9 +79,9 @@ const struct S s; // zero-init-var-warning {{default initialization of an obje
72
79
cxx-error {{call to implicitly-deleted default constructor of 'const struct S'}}
73
80
74
81
voidfunc() {
75
-
constinta; // unsafe-var-warning {{default initialization of an object of type 'const int' leaves the object uninitialized and is incompatible with C++}} \
82
+
constinta; // unsafe-var-warning {{default initialization of an object of type 'const int' leaves the object uninitialized}} \
83
+
unsafe-var-compat-warning {{default initialization of an object of type 'const int' leaves the object uninitialized and is incompatible with C++}} \
76
84
cxx-error {{default initialization of an object of const type 'const int'}}
77
85
staticconstintb; // zero-init-var-warning {{default initialization of an object of type 'const int' is incompatible with C++}} \
78
86
cxx-error {{default initialization of an object of const type 'const int'}}
Copy file name to clipboardExpand all lines: clang/test/SemaOpenCL/invalid-block.cl
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ void f1(void) {
14
14
f0(bl2);
15
15
bl1=bl2; // expected-error{{invalid operands to binary expression ('int (__generic ^const __private)(void)' and 'int (__generic ^const __private)(void)')}}
16
16
int (^constbl3)(void); // expected-error{{invalid block variable declaration - must be initialized}} \
17
-
expected-warning {{default initialization of an object of type 'int (__generic ^const __private)(void)' leaves the object uninitialized and is incompatible with C++}}
17
+
expected-warning {{default initialization of an object of type 'int (__generic ^const __private)(void)' leaves the object uninitialized}}
18
18
}
19
19
20
20
// A block with extern storage class is not allowed.
0 commit comments