gcc/testsuite/gdc.test/fail_compilation/cppeh2.d
raw| 1 | // DISABLED: win32 win64 |
| 2 | /* |
| 3 | TEST_OUTPUT: |
| 4 | --- |
| 5 | fail_compilation/cppeh2.d(21): Error: cannot mix catching D and C++ exceptions in the same try-catch |
| 6 | --- |
| 7 | */ |
| 8 | |
| 9 | version(Windows) static assert(0, "This test should not run on this platform"); |
| 10 | |
| 11 | extern (C++, std) |
| 12 | { |
| 13 | class exception { } |
| 14 | } |
| 15 | |
| 16 | void bar(); |
| 17 | void abc(); |
| 18 | |
| 19 | void foo() |
| 20 | { |
| 21 | try |
| 22 | { |
| 23 | bar(); |
| 24 | } |
| 25 | catch (std.exception e) |
| 26 | { |
| 27 | abc(); |
| 28 | } |
| 29 | catch (Exception e) |
| 30 | { |
| 31 | abc(); |
| 32 | } |
| 33 | } |