DMD 1.031 and 2.015 releases

Robert Fraser fraserofthenight at gmail.com
Wed Jun 18 17:06:43 PDT 2008


Walter Bright Wrote:

> Robert Fraser wrote:
> > Out of curiosity, why doesn't return type deduction work for all 
> > functions (is this panned?). It seems to be possible to do:
> > 
> > auto foo()()
> > {
> >     return 10;
> > }
> > 
> > but not:
> > 
> > auto foo()
> > {
> >     return 10;
> > }
> 
> Good question!
> 
> Because deducing the return type requires semantic analysis, and for 
> functions that introduces the old forward reference chicken-and-egg 
> problem. This doesn't happen with function templates, because semantic 
> analysis of them doesn't happen until later.

(Apologies for the web interface)

Any way to rewrite them as no-parameter templates automatically if possible and
issue a sensible compiler message if they can't be (i.e. a virtual function).


More information about the Digitalmars-d-announce mailing list