[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / CXX / stmt.stmt / stmt.label / p1.cpp
blob90367f829566c3a75a5f682a68472cf4871c9179
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 void f()
5 int x = 0;
6 goto label1;
8 label1: // expected-note{{previous definition is here}}
9 x = 1;
10 goto label2; // expected-error{{use of undeclared label 'label2'}}
12 label1: // expected-error{{redefinition of label 'label1'}}
13 x = 2;
16 void h()
18 int x = 0;
19 switch (x)
21 case 1:;
22 default:; // expected-error{{multiple default labels in one switch}}
23 default:; // expected-note{{previous case defined here}}