gcc/testsuite/gdc.test/compilable/extra-files/imp12624.d
raw| 1 | // typecons.d |
| 2 | template RebindableCommon(T, U, This) |
| 3 | { |
| 4 | union { U stripped; } |
| 5 | |
| 6 | void opAssign(T another) |
| 7 | { |
| 8 | stripped = cast() another; |
| 9 | } |
| 10 | |
| 11 | this(T initializer) |
| 12 | { |
| 13 | opAssign(initializer); |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | |
| 18 | template Rebindable(T) |
| 19 | { |
| 20 | static if (is(T == immutable U, U)) |
| 21 | struct Rebindable |
| 22 | { |
| 23 | mixin RebindableCommon!(T, U, Rebindable); |
| 24 | } |
| 25 | } |
| 26 | |
| 27 |