Debian Codegraph @

gcc/testsuite/gdc.test/fail_compilation/bug8150a.d

raw
1 // https://issues.dlang.org/show_bug.cgi?id=8150: nothrow check doesn't work for constructor
2 /*
3 TEST_OUTPUT:
4 ---
5 fail_compilation/bug8150a.d(14): Error: `object.Exception` is thrown but not caught
6 fail_compilation/bug8150a.d(12): Error: constructor `bug8150a.Foo.this` may throw but is marked as `nothrow`
7 ---
8 */
9
10 struct Foo
11 {
12 this(int) nothrow
13 {
14 throw new Exception("something");
15 }
16 }
17
18 void main() {
19 Foo(1);
20 }