[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / warn-unused-label-error.cpp
blobceef8894768e0cde2a80247391bfd8082fcf5bc0
1 // RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -verify %s
3 static int unused_local_static;
5 namespace PR8455 {
6 void f() {
7 A: // expected-warning {{unused label 'A'}}
8 __attribute__((unused)) int i; // attribute applies to variable
9 B: // attribute applies to label
10 __attribute__((unused)); int j; // expected-warning {{unused variable 'j'}}
13 void g() {
14 C: // unused label 'C' will not appear here because an error has occurred
15 __attribute__((unused)) // expected-error {{an attribute list cannot appear here}}
16 #pragma weak unused_local_static
20 void h() {
22 #pragma weak unused_local_static
23 __attribute__((unused)) // expected-error {{'unused' attribute cannot be applied to a statement}}