Silly struct behaviour
JN via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 13 11:48:27 PDT 2017
On Thursday, 13 July 2017 at 18:09:46 UTC, H. S. Teoh wrote:
>
> It's not quite so simple. Consider for example:
>
> struct Foo { int bar; }
> struct Oof { int bar; }
>
> void process(Foo foo) { }
> void process(Oof oof) { formatDisk(); }
>
> void main() {
> process({bar : 5}); // which overload should get called?
> }
>
in this case, I'd expect something like:
error: ambiguous struct definition, could match process(Foo) or
process(Oof)
More information about the Digitalmars-d-learn
mailing list