gcc/testsuite/gdc.test/fail_compilation/cppeh1.d
raw| 1 | // DISABLED: win32 win64 |
| 2 | /* |
| 3 | TEST_OUTPUT: |
| 4 | --- |
| 5 | fail_compilation/cppeh1.d(26): Error: catching C++ class objects is not allowed in a `@safe` function |
| 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 | @safe: |
| 17 | void bar(); |
| 18 | void abc(); |
| 19 | |
| 20 | void foo() |
| 21 | { |
| 22 | try |
| 23 | { |
| 24 | bar(); |
| 25 | } |
| 26 | catch (std.exception e) |
| 27 | { |
| 28 | abc(); |
| 29 | } |
| 30 | } |