[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / SemaCXX / cxx1z-init-statement-warn-unused.cpp
blob5390da4f3f5a6af4e4d2da9f992a0d54109f71ab
1 // RUN: %clang_cc1 -std=c++1z -verify -Wuninitialized %s
3 void testIf() {
4 if (bool b; b) // expected-warning {{uninitialized}} expected-note {{to silence}}
6 if (int a, b = 2; a) // expected-warning {{uninitialized}} expected-note {{to silence}}
8 int a;
9 if (a = 0; a) {} // OK
12 void testSwitch() {
13 switch (bool b; b) { // expected-warning {{uninitialized}} expected-warning {{boolean value}} expected-note {{to silence}}
14 case 0:
15 break;
17 switch (int a, b = 7; a) { // expected-warning {{uninitialized}} expected-note {{to silence}}
18 case 0:
19 break;
21 int c;
22 switch (c = 0; c) { // OK
23 case 0:
24 break;