cannot have overloaded nested functions?
Timothee Cour
thelastmammoth at gmail.com
Thu May 16 00:28:15 PDT 2013
at the very least (or until it gets fixed) dmd should emit a more friendly
error message:
'cannot overload a function in a nested scope'
otherwise this is hard to understand.
On Wed, May 15, 2013 at 11:43 PM, Jonathan M Davis <jmdavisProg at gmx.com>wrote:
> On Wednesday, May 15, 2013 20:48:19 Steven Schveighoffer wrote:
> > On Wed, 15 May 2013 19:10:49 -0400, Timothee Cour
> >
> > <thelastmammoth at gmail.com> wrote:
> > > why isn't this supported?
> > >
> > > void main(){
> > >
> > > void fun();
> > > void fun(int x);//Error: declaration fun is already defined
> > >
> > > }
> >
> > Don't know, but it hasn't been supported ever. Spec clearly states it's
> > not supported, but not why. I suppose it is not difficult to name it
> > something else?
> >
> > Note that there are a lot of different rules with nested functions that
> > don't apply to normal functions.
>
> You can't have multiple instantiations of templated nested functions
> either.
> IIRC, I created a bug report on it, and Walter closed it as won't fix, but
> I
> don't remember what his reasoning was, though IIRC, he was essentially of
> the
> opinion that nested functions didn't need to have the full capabilities of
> normal functions. I assume that that simplifies their implementation, but I
> don't know.
>
> - Jonathan M Davis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20130516/c053cc0c/attachment-0001.html>
More information about the Digitalmars-d-learn
mailing list