| 1 |
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -fexceptions -verify %s |
| 2 |
|
| 3 |
void func1(int i) { // expected-note{{previous definition is here}} |
| 4 |
int i; // expected-error{{redefinition of 'i'}} |
| 5 |
} |
| 6 |
|
| 7 |
void func2(int i) try { // expected-note{{previous definition is here}} |
| 8 |
int i; // expected-error{{redefinition of 'i'}} |
| 9 |
} catch (...) { |
| 10 |
} |
| 11 |
|
| 12 |
void func3(int i) try { // expected-note {{previous definition is here}} |
| 13 |
} catch (int i) { // expected-error {{redefinition of 'i'}} |
| 14 |
} |
| 15 |
|
| 16 |
void func4(int i) try { // expected-note{{previous definition is here}} |
| 17 |
} catch (...) { |
| 18 |
int i; // expected-error{{redefinition of 'i'}} |
| 19 |
} |
| 20 |
|
| 21 |
void func5() try { |
| 22 |
int i; |
| 23 |
} catch (...) { |
| 24 |
int j = i; // expected-error{{use of undeclared identifier 'i'}} |
| 25 |
} |
| 26 |
|
| 27 |
void func6() try { |
| 28 |
} catch (int i) { // expected-note{{previous definition is here}} |
| 29 |
int i; // expected-error{{redefinition of 'i'}} |
| 30 |
} |
| 31 |
|
| 32 |
void func7() { |
| 33 |
try { |
| 34 |
} catch (int i) { // expected-note{{previous definition is here}} |
| 35 |
int i; // expected-error{{redefinition of 'i'}} |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
void func8() { |
| 40 |
int i; |
| 41 |
try { |
| 42 |
int i; |
| 43 |
} catch (...) { |
| 44 |
} |
| 45 |
} |
| 46 |
|
| 47 |
void func9() { |
| 48 |
if (bool b = true) |
| 49 |
try { |
| 50 |
int b; // FIXME: this probably should be invalid, maybe |
| 51 |
} catch (...) { |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
void func10() { |
| 56 |
if (bool b = true) |
| 57 |
if (true) { |
| 58 |
int b; // FIXME: decide whether this is valid |
| 59 |
} |
| 60 |
} |
| 61 |
|
| 62 |
void func11(int a) { |
| 63 |
try { |
| 64 |
} catch (int a) { // OK |
| 65 |
} |
| 66 |
} |