What am I missin with const?

Timon Gehr timon.gehr at gmx.ch
Tue Jan 29 01:45:16 PST 2013


On 01/29/2013 10:38 AM, deadalnix wrote:
> On Tuesday, 29 January 2013 at 09:10:28 UTC, bearophile wrote:
>> deadalnix:
>>
>>> I wish this syntax will be fixed, but I have no hope. We just will
>>> see the problem popping again and again I guess.
>>
>> I asked for that fix, but Walter closed down that request in Bugzilla.
>> I still think he was wrong.
>>
>> I now open a smaller request that can't fix the problem fully:
>> http://d.puremagic.com/issues/show_bug.cgi?id=9422
>>
>
> Well I think the error message you propose isn't possible as it would
> cause many problems in generic code.
>

How?

> const applied to the rturn type should be the way to go. It is basically
> what everybody except at first when looking at the code. But it is
> probably too late to change that.

The current behaviour emerges because the parser treats

const void foo(){}

exactly like

const{
     void foo(){}
}


More information about the Digitalmars-d mailing list