diff options
Diffstat (limited to 'clang/test/Sema')
| -rw-r--r-- | clang/test/Sema/default.c | 2 | ||||
| -rw-r--r-- | clang/test/Sema/if-empty-body.c | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/test/Sema/default.c b/clang/test/Sema/default.c index b51ab9a55cc..92f7278033f 100644 --- a/clang/test/Sema/default.c +++ b/clang/test/Sema/default.c @@ -3,6 +3,6 @@ void f5 (int z) { if (z) default: // expected-error {{not in switch statement}} - ; + ; // expected-warning {{if statement has empty body}} } diff --git a/clang/test/Sema/if-empty-body.c b/clang/test/Sema/if-empty-body.c new file mode 100644 index 00000000000..1dc9e448177 --- /dev/null +++ b/clang/test/Sema/if-empty-body.c @@ -0,0 +1,9 @@ +// RUN: clang -parse-ast -verify %s + +void f1(int a) { + if (a); // expected-warning {{if statement has empty body}} +} + +void f2(int a) { + if (a) {} +} |

