summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gdc.test/fail_compilation/bug8150a.d
blob: a03f850ae80d6ac67762307c831286baea72690e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// 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: `nothrow` constructor `bug8150a.Foo.this` may throw
---
*/

struct Foo
{
    this(int) nothrow
    {
        throw new Exception("something");
    }
}

void main() {
    Foo(1);
}