summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/SemaCXX/warn-empty-body.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/warn-empty-body.cpp b/clang/test/SemaCXX/warn-empty-body.cpp
index a248c4251d5..bd6b47f053f 100644
--- a/clang/test/SemaCXX/warn-empty-body.cpp
+++ b/clang/test/SemaCXX/warn-empty-body.cpp
@@ -238,6 +238,26 @@ void test6(int x, int y) {
}
}
+void test_if_else(int x) {
+ if (x); // expected-warning{{if statement has empty body}} expected-note{{separate line}}
+
+ if (x)
+ ; // no-warning
+
+ if (x)
+ ; // no-warning
+ else
+ ; // no-warning
+
+ if (x)
+ ; // no-warning
+ else; // expected-warning{{else clause has empty body}} expected-note{{separate line}}
+
+ if (x)
+ ; // no-warning
+ else EMPTY(x); // no-warning
+}
+
void test_errors(int x) {
if (1)
aa; // expected-error{{use of undeclared identifier}}
OpenPOWER on IntegriCloud