diff options
Diffstat (limited to 'gcc/testsuite/gdc.test/compilable/test20021.d')
-rw-r--r-- | gcc/testsuite/gdc.test/compilable/test20021.d | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/compilable/test20021.d b/gcc/testsuite/gdc.test/compilable/test20021.d new file mode 100644 index 00000000000..26ed1acf6bb --- /dev/null +++ b/gcc/testsuite/gdc.test/compilable/test20021.d @@ -0,0 +1,22 @@ +// https://issues.dlang.org/show_bug.cgi?id=20021 +struct S +{ + bool opCast(T : bool)() { return true; } + S prop() {return this;} + S prop(S newThis) {return this;} +} + +struct T +{ + bool opCast(T : bool)() { return false; } +} + +void test20021() +{ + static if (T.init) + static assert(false); + + // ensure properties are resolved + static if (!(true && T.init || (S.init.prop = S.init).prop)) + static assert(false); +} |