auto

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


On Wed, Aug 12, 2009 at 10:22 AM, Jarrett
Billingsley<jarrett.billingsley at gmail.com> wrote:
> 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

Reported: http://d.puremagic.com/issues/show_bug.cgi?id=3247



More information about the Digitalmars-d mailing list