summaryrefslogtreecommitdiffstats
path: root/test/Sema/warn-unused-variables.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/warn-unused-variables.c')
-rw-r--r--test/Sema/warn-unused-variables.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/Sema/warn-unused-variables.c b/test/Sema/warn-unused-variables.c
index 3661506..58e52b1 100644
--- a/test/Sema/warn-unused-variables.c
+++ b/test/Sema/warn-unused-variables.c
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wunused-variable -fblocks -verify %s
struct s0 {
unsigned int i;
@@ -17,3 +17,16 @@ void f1(void) {
(void)sizeof(i);
return;
}
+
+// PR5933
+int f2() {
+ int X = 4; // Shouldn't have a bogus 'unused variable X' warning.
+ return Y + X; // expected-error {{use of undeclared identifier 'Y'}}
+}
+
+int f3() {
+ int X1 = 4;
+ (void)(Y1 + X1); // expected-error {{use of undeclared identifier 'Y1'}}
+ (void)(^() { int X = 4; }); // expected-warning{{unused}}
+ (void)(^() { int X = 4; return Y + X; }); // expected-error {{use of undeclared identifier 'Y'}}
+}
OpenPOWER on IntegriCloud