diff options
Diffstat (limited to 'test/SemaCXX/unreachable-code.cpp')
-rw-r--r-- | test/SemaCXX/unreachable-code.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/SemaCXX/unreachable-code.cpp b/test/SemaCXX/unreachable-code.cpp index 528bba7..40d0c00 100644 --- a/test/SemaCXX/unreachable-code.cpp +++ b/test/SemaCXX/unreachable-code.cpp @@ -39,3 +39,20 @@ void test3() { bar(); // expected-warning {{will never be executed}} } } + +// PR 6130 - Don't warn about bogus unreachable code with throw's and +// temporary objects. +class PR6130 { +public: + PR6130(); + ~PR6130(); +}; + +int pr6130(unsigned i) { + switch(i) { + case 0: return 1; + case 1: return 2; + default: + throw PR6130(); // no-warning + } +} |