gcc/testsuite/gdc.test/runnable/test19782.d
raw| 1 | // https://issues.dlang.org/show_bug.cgi?id=19782 |
| 2 | class Inner |
| 3 | { |
| 4 | int a; |
| 5 | } |
| 6 | |
| 7 | class Outer |
| 8 | { |
| 9 | Inner inner; alias inner this; |
| 10 | this(Inner i) { inner = i; } |
| 11 | } |
| 12 | |
| 13 | void main() |
| 14 | { |
| 15 | Inner[] inners = []; |
| 16 | inners ~= new Inner; |
| 17 | inners ~= new Outer(new Inner); // Appends null |
| 18 | |
| 19 | foreach(inner; inners) |
| 20 | { |
| 21 | assert(inner.a == 0); |
| 22 | } |
| 23 | } |