| 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/bug8150b.d(15): Error: `object.Exception` is thrown but not caught |
| 6 |
fail_compilation/bug8150b.d(13): Error: constructor `bug8150b.Foo.__ctor!().this` may throw but is marked as `nothrow` |
| 7 |
fail_compilation/bug8150b.d(20): Error: template instance `bug8150b.Foo.__ctor!()` error instantiating |
| 8 |
--- |
| 9 |
*/ |
| 10 |
|
| 11 |
struct Foo |
| 12 |
{ |
| 13 |
this()(int) nothrow |
| 14 |
{ |
| 15 |
throw new Exception("something"); |
| 16 |
} |
| 17 |
} |
| 18 |
|
| 19 |
void main() { |
| 20 |
Foo(1); |
| 21 |
} |