|
| 1 | +// Both of these should enable everything. |
| 2 | +// RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field,zero-init-var,zero-init-field -Wc++-compat %s |
| 3 | +// RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field,zero-init-var,zero-init-field -Wdefault-const-init %s |
| 4 | + |
| 5 | +// This should enable nothing. |
| 6 | +// RUN: %clang_cc1 -fsyntax-only -verify=good -Wno-default-const-init-unsafe %s |
| 7 | + |
| 8 | +// Only unsafe field and variable diagnostics |
| 9 | +// RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field %s |
1 | 10 | // RUN: %clang_cc1 -fsyntax-only -verify=unsafe-var,unsafe-field -Wdefault-const-init-unsafe %s
|
2 | 11 |
|
| 12 | +// Only zero init field and variable diagnostics |
| 13 | +// RUN: %clang_cc1 -fsyntax-only -verify=zero-init-var,zero-init-field -Wdefault-const-init -Wno-default-const-init-unsafe %s |
| 14 | + |
| 15 | +// Only zero init and unsafe field diagnostics |
| 16 | +// RUN: %clang_cc1 -fsyntax-only -verify=zero-init-field,unsafe-field -Wno-default-const-init-var-unsafe -Wdefault-const-init-field %s |
| 17 | + |
| 18 | +// Only zero init and unsafe variable diagnostics |
| 19 | +// RUN: %clang_cc1 -fsyntax-only -verify=zero-init-var,unsafe-var -Wno-default-const-init-field-unsafe -Wdefault-const-init-var %s |
| 20 | + |
| 21 | +// C++ tests |
| 22 | +// RUN: %clang_cc1 -fsyntax-only -verify=cxx -x c++ %s |
| 23 | + |
| 24 | +// good-no-diagnostics |
| 25 | + |
3 | 26 | struct A { int i; };
|
4 | 27 | struct S{ const int i; }; // unsafe-field-note 2 {{member 'i' declared 'const' here}} \
|
5 | 28 | cxx-note 3 {{default constructor of 'S' is implicitly deleted because field 'i' of const-qualified type 'const int' would not be initialized}}
|
@@ -45,7 +68,7 @@ static const int j; // zero-init-var-warning {{default initialization of an obje
|
45 | 68 | cxx-error {{default initialization of an object of const type 'const int'}}
|
46 | 69 | const int k; // zero-init-var-warning {{default initialization of an object of type 'const int' is incompatible with C++}} \
|
47 | 70 | cxx-error {{default initialization of an object of const type 'const int'}}
|
48 |
| -const struct S s; // zero-init-field-warning {{default initialization of an object of type 'const struct S' is incompatible with C++}} \ |
| 71 | +const struct S s; // zero-init-var-warning {{default initialization of an object of type 'const struct S' is incompatible with C++}} \ |
49 | 72 | cxx-error {{call to implicitly-deleted default constructor of 'const struct S'}}
|
50 | 73 |
|
51 | 74 | void func() {
|
|
0 commit comments