Code behaves incorrectly if it is compiled in std.functional

via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 6 05:36:09 PDT 2015


On Saturday, 6 June 2015 at 06:05:46 UTC, ketmar wrote:
> On Fri, 05 Jun 2015 18:35:49 +0000, Marc Schütz wrote:
>
>> On Friday, 5 June 2015 at 17:50:55 UTC, ketmar wrote:
>>> `const int` works, so i can't see why `auto auto` is failing.
>> 
>> Wrong analogy. Try `const const`, and it will fail with the 
>> same error
>> as `auto auto`: "redundant attribute".
>
> nope. in `auto auto` one `auto` is storage type, and another 
> `auto` is a
> type placeholder.

No, as others have explained.

> see, `const auto` works, so `auto` can play role of a
> type placeholder. so `auto auto` should be accepted, if you 
> insists that
> it can play a role of storage class.

`const auto` isn't contradictory. It's simply two storage 
classes, one of which is the default.

Besides, there's not much sense in doing experiments with DMD to 
find out "the true nature" of auto. DMD is clearly inconsistent, 
as seen from your observation about foreach().


More information about the Digitalmars-d mailing list