gcc/testsuite/gdc.test/compilable/test20021.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=20021 |
| 2 | struct S |
| 3 | { |
| 4 | bool opCast(T : bool)() { return true; } |
| 5 | S prop() {return this;} |
| 6 | S prop(S newThis) {return this;} |
| 7 | } |
| 8 | |
| 9 | struct T |
| 10 | { |
| 11 | bool opCast(T : bool)() { return false; } |
| 12 | } |
| 13 | |
| 14 | void test20021() |
| 15 | { |
| 16 | static if (T.init) |
| 17 | static assert(false); |
| 18 | |
| 19 | // ensure properties are resolved |
| 20 | static if (!(true && T.init || (S.init.prop = S.init).prop)) |
| 21 | static assert(false); |
| 22 | } |