[Issue 13848] overlapping initialization for r

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Dec 11 00:02:18 PST 2014


https://issues.dlang.org/show_bug.cgi?id=13848

--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to deadalnix from comment #2)
> What ? That do not make any sense. Also, I was able to trigger that error
> with an explicit constructor in a much more convoluted sample code.
> Basically as follow:

Currently a struct literal expression SS(a, p) always tries to match the
arguments to the struct fields by using the order of struct field declarations.
In the matching process, the overlapping between fields is not merely
considered.

I think it's similar to function call. The first argument will match to the
first parameter (first field), and the second argument will match to the second
parameter (second field), and the third argument will ...

Therefore, currently struct literal expression cannot correctly initialize
overlapped fields. It's a known limitation.

But the error diagnostic would be a bit unkind. It would be better to  report
the type mismatch between the second argument and corresponding struct field.

--


More information about the Digitalmars-d-bugs mailing list