Mike Stump | 04c6851 | 2010-01-21 15:20:48 +0000 | [diff] [blame] | 1 | // RUN: %clang %s -fsyntax-only -Xclang -verify -fblocks -Wunreachable-code -Wno-unused-value |
| 2 | |
Mike Stump | cc3a853 | 2010-01-21 17:21:23 +0000 | [diff] [blame] | 3 | int &halt() __attribute__((noreturn)); |
| 4 | int &live(); |
Mike Stump | 04c6851 | 2010-01-21 15:20:48 +0000 | [diff] [blame] | 5 | int dead(); |
| 6 | int liveti() throw(int); |
| 7 | int (*livetip)() throw(int); |
| 8 | |
| 9 | int test1() { |
| 10 | try { |
| 11 | live(); |
| 12 | } catch (int i) { |
| 13 | live(); |
| 14 | } |
| 15 | return 1; |
| 16 | } |
| 17 | |
| 18 | void test2() { |
| 19 | try { |
| 20 | live(); |
| 21 | } catch (int i) { |
| 22 | live(); |
| 23 | } |
| 24 | try { |
| 25 | liveti(); |
| 26 | } catch (int i) { |
| 27 | live(); |
| 28 | } |
| 29 | try { |
| 30 | livetip(); |
| 31 | } catch (int i) { |
| 32 | live(); |
| 33 | } |
| 34 | throw 1; |
| 35 | dead(); // expected-warning {{will never be executed}} |
| 36 | } |
Mike Stump | cc3a853 | 2010-01-21 17:21:23 +0000 | [diff] [blame] | 37 | |
| 38 | |
| 39 | void test3() { |
| 40 | halt() |
| 41 | --; // expected-warning {{will never be executed}} |
Mike Stump | c18c403 | 2010-01-21 19:44:04 +0000 | [diff] [blame] | 42 | halt() |
Mike Stump | fcd6f94 | 2010-01-21 22:12:18 +0000 | [diff] [blame^] | 43 | ? // expected-warning {{will never be executed}} |
Mike Stump | c18c403 | 2010-01-21 19:44:04 +0000 | [diff] [blame] | 44 | dead() : dead(); |
Mike Stump | fcd6f94 | 2010-01-21 22:12:18 +0000 | [diff] [blame^] | 45 | live(), |
| 46 | float // expected-warning {{will never be executed}} |
| 47 | (halt()); |
Mike Stump | cc3a853 | 2010-01-21 17:21:23 +0000 | [diff] [blame] | 48 | } |