auto

Jarrett Billingsley jarrett.billingsley at gmail.com
Wed Aug 12 07:22:22 PDT 2009


On Wed, Aug 12, 2009 at 9:18 AM, Ary Borenszweig<ary at esperanto.org.ar> wrote:
> This compiles and runs in D2:
>
> --
> import std.stdio;
>
> auto foo() {
>    return 1;
> }
>
> void main() {
>    writefln("%s", foo());
> }
> --
>
> Since when a non-templated function can have its return type deduced? :)

Cool.  I'm testing this and it really does seem to be non-templated.
So of course, the first thing I tried was this:

class A
{
    auto foo() { return 0; }
}

class B : A
{
    auto foo() { return 5; }
}

but DMD crashes.  :P



More information about the Digitalmars-d mailing list