summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/warn-unused-variables.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/warn-unused-variables.cpp')
-rw-r--r--test/SemaCXX/warn-unused-variables.cpp25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/SemaCXX/warn-unused-variables.cpp b/test/SemaCXX/warn-unused-variables.cpp
index 00597f9..93d2f6f 100644
--- a/test/SemaCXX/warn-unused-variables.cpp
+++ b/test/SemaCXX/warn-unused-variables.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -Wunused-label -verify %s
template<typename T> void f() {
T t;
t = 17;
@@ -128,3 +128,26 @@ namespace ctor_with_cleanups {
}
#include "Inputs/warn-unused-variables.h"
+
+namespace PR8455 {
+ void f() {
+ A: // expected-warning {{unused label 'A'}}
+ __attribute__((unused)) int i; // attribute applies to variable
+ B: // attribute applies to label
+ __attribute__((unused)); int j; // expected-warning {{unused variable 'j'}}
+ }
+
+ void g() {
+ C: // unused label 'C' will not appear here because an error occurs
+ __attribute__((unused))
+ #pragma weak unused_local_static // expected-error {{expected ';' after __attribute__}}
+ ;
+ }
+
+ void h() {
+ D: // expected-warning {{unused label 'D'}}
+ #pragma weak unused_local_static
+ __attribute__((unused)) // expected-warning {{declaration does not declare anything}}
+ ;
+ }
+}
OpenPOWER on IntegriCloud