diff options
Diffstat (limited to 'gcc/testsuite/gdc.test/runnable/test19441.d')
-rw-r--r-- | gcc/testsuite/gdc.test/runnable/test19441.d | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/gdc.test/runnable/test19441.d b/gcc/testsuite/gdc.test/runnable/test19441.d new file mode 100644 index 00000000000..5dcb573600a --- /dev/null +++ b/gcc/testsuite/gdc.test/runnable/test19441.d @@ -0,0 +1,24 @@ +// https://issues.dlang.org/show_bug.cgi?id=19441 +struct S1 +{ + int a; + long b; + alias a this; +} + +struct S2 +{ + S1 v; + alias v this; +} + +void main() +{ + auto x = S2(S1(1, 12345678)); + assert(x.a == 1 && x.b == 12345678); // prints: 1 12345678 + S1 y; + y = x; + assert(y.a == 1 && y.b == 12345678); + y = x.v; + assert(y.a == 1 && y.b == 12345678); +} |