dmd/compiler/test/fail_compilation/bug8150a.d
2022-07-09 18:53:07 +02:00

20 lines
434 B
D

// https://issues.dlang.org/show_bug.cgi?id=8150: nothrow check doesn't work for constructor
/*
TEST_OUTPUT:
---
fail_compilation/bug8150a.d(14): Error: `object.Exception` is thrown but not caught
fail_compilation/bug8150a.d(12): Error: constructor `bug8150a.Foo.this` may throw but is marked as `nothrow`
---
*/
struct Foo
{
this(int) nothrow
{
throw new Exception("something");
}
}
void main() {
Foo(1);
}