diff options
Diffstat (limited to 'test/Analysis/unreachable-code-path.c')
-rw-r--r-- | test/Analysis/unreachable-code-path.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/Analysis/unreachable-code-path.c b/test/Analysis/unreachable-code-path.c index da14f4c..48a3462 100644 --- a/test/Analysis/unreachable-code-path.c +++ b/test/Analysis/unreachable-code-path.c @@ -122,3 +122,20 @@ void test10() { goto d; f: ; } + +// test11: we can actually end up in the default case, even if it is not +// obvious: there might be something wrong with the given argument. +enum foobar { FOO, BAR }; +extern void error(); +void test11(enum foobar fb) { + switch (fb) { + case FOO: + break; + case BAR: + break; + default: + error(); // no-warning + return; + error(); // expected-warning {{never executed}} + } +} |