dmd/compiler/test/fail_compilation/cppeh1.d
Dennis 9b94878c85
Make safe error messages consistent (#20654)
Co-authored-by: Dennis Korpel <dennis@sarc.nl>
2025-01-08 13:46:38 +08:00

30 lines
421 B
D

// DISABLED: win32 win64
/*
TEST_OUTPUT:
---
fail_compilation/cppeh1.d(26): Error: catching C++ class objects is not allowed in a `@safe` function
---
*/
version (Windows) static assert(0, "This test should not run on this platform");
extern (C++, std)
{
class exception { }
}
@safe:
void bar();
void abc();
void foo()
{
try
{
bar();
}
catch (std.exception e)
{
abc();
}
}