Silly struct behaviour
H. S. Teoh via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Jul 13 12:24:52 PDT 2017
On Thu, Jul 13, 2017 at 06:48:27PM +0000, JN via Digitalmars-d-learn wrote:
> 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)
File an enhancement request:
https://issues.dlang.org/enter_bug.cgi
You never know, we may be able to convince Walter to add this at some
point. :-P
T
--
English has the lovely word "defenestrate", meaning "to execute by throwing someone out a window", or more recently "to remove Windows from a computer and replace it with something useful". :-) -- John Cowan
More information about the Digitalmars-d-learn
mailing list