| 1 |
/* |
| 2 |
TEST_OUTPUT: |
| 3 |
--- |
| 4 |
fail_compilation/test15989.d(39): Error: variable `test15989.main.ctRegex` : Unable to initialize enum with class or pointer to struct. Use static const variable instead. |
| 5 |
fail_compilation/test15989.d(48): Error: variable `test15989.test.c` : Unable to initialize enum with class or pointer to struct. Use static const variable instead. |
| 6 |
fail_compilation/test15989.d(49): Error: cannot use non-constant CTFE pointer in an initializer `new int(3)` |
| 7 |
--- |
| 8 |
*/ |
| 9 |
|
| 10 |
// https://issues.dlang.org/show_bug.cgi?id=15989 |
| 11 |
|
| 12 |
import core.stdc.stdio; |
| 13 |
|
| 14 |
interface Kickstart{ |
| 15 |
bool foo( int ); |
| 16 |
} |
| 17 |
|
| 18 |
class ShiftOr : Kickstart |
| 19 |
{ |
| 20 |
bool foo( int i ) |
| 21 |
{ |
| 22 |
printf("i = %d\n", i); |
| 23 |
return false; |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
struct Regex |
| 28 |
{ |
| 29 |
Kickstart kickstart; |
| 30 |
} |
| 31 |
|
| 32 |
Regex regex() |
| 33 |
{ |
| 34 |
return Regex(new ShiftOr()); |
| 35 |
} |
| 36 |
|
| 37 |
void main() |
| 38 |
{ |
| 39 |
enum ctRegex = regex(); |
| 40 |
Regex r = ctRegex; |
| 41 |
r.kickstart.foo(7); |
| 42 |
} |
| 43 |
|
| 44 |
class C { } |
| 45 |
|
| 46 |
void test() |
| 47 |
{ |
| 48 |
enum c = new C(); |
| 49 |
enum pi = new int(3); |
| 50 |
} |