| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/ice10651.d(13): Error: can only throw class objects derived from `Throwable`, not type `int*` |
| 5 |
fail_compilation/ice10651.d(19): Deprecation: cannot throw object of qualified type `immutable(Exception)` |
| 6 |
fail_compilation/ice10651.d(20): Deprecation: cannot throw object of qualified type `const(Dummy)` |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
void main() |
| 11 |
{ |
| 12 |
alias T = int; |
| 13 |
throw new T(); // ICE |
| 14 |
} |
| 15 |
|
| 16 |
void f() |
| 17 |
{ |
| 18 |
immutable c = new Exception(""); |
| 19 |
if (c) throw c; |
| 20 |
throw new const Dummy([]); |
| 21 |
} |
| 22 |
|
| 23 |
class Dummy: Exception |
| 24 |
{ |
| 25 |
int[] data; |
| 26 |
@safe pure nothrow this(immutable int[] data) immutable |
| 27 |
{ |
| 28 |
super("Dummy"); |
| 29 |
this.data = data; |
| 30 |
} |
| 31 |
} |