gcc/testsuite/gdc.test/fail_compilation/fail304.d
raw| 1 | /* |
| 2 | TEST_OUTPUT: |
| 3 | --- |
| 4 | fail_compilation/fail304.d(15): Error: cannot cast expression `foo()` of type `Small` to `Large` because of different sizes |
| 5 | --- |
| 6 | */ |
| 7 | |
| 8 | struct Small { uint x; } |
| 9 | struct Large { uint x, y, z; } |
| 10 | Small foo() { return Small(); } |
| 11 | void main() |
| 12 | { |
| 13 | Large l; |
| 14 | Small s; |
| 15 | l = cast(Large)foo(); |
| 16 | } |