| 1 |
/* |
| 2 |
REQUIRED_ARGS: -release -check=assert=on |
| 3 |
PERMUTE_ARGS: -check=invariant=on |
| 4 |
*/ |
| 5 |
|
| 6 |
// https://issues.dlang.org/show_bug.cgi?id=22945 |
| 7 |
|
| 8 |
bool hitStruct; |
| 9 |
bool hitClass; |
| 10 |
|
| 11 |
struct S |
| 12 |
{ |
| 13 |
this(int) {} |
| 14 |
invariant { hitStruct = true; } |
| 15 |
} |
| 16 |
|
| 17 |
class C |
| 18 |
{ |
| 19 |
this() {} |
| 20 |
invariant { hitClass = true; } |
| 21 |
} |
| 22 |
|
| 23 |
int main() |
| 24 |
{ |
| 25 |
cast(void) S(0); |
| 26 |
cast(void) new C(); |
| 27 |
|
| 28 |
version(D_Invariants) |
| 29 |
{ |
| 30 |
assert(hitStruct && hitClass); |
| 31 |
} |
| 32 |
else |
| 33 |
{ |
| 34 |
assert(!hitStruct && !hitClass); |
| 35 |
} |
| 36 |
|
| 37 |
return 0; |
| 38 |
} |