Code behaves incorrectly if it is compiled in std.functional

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 5 10:50:55 PDT 2015


On Fri, 05 Jun 2015 16:42:25 +0000, Mafi wrote:

> On Friday, 5 June 2015 at 16:26:34 UTC, ketmar wrote:
>> On Fri, 05 Jun 2015 15:17:50 +0000, Mafi wrote:
>>
>>> auto int x  = 10;
>>> 
>>> should work. It's just consistent.
>>
>> then `auto auto` should work too. it's a "declaration mark" +
>> "storage class".
> 
> Well, no. Any storage class marks a declaration just by itself. You
> don't use it as a "declaration mark" or "storage class", just use a
> storage class which definitely declares something new. See also
> http://dlang.org/declaration.html
> 
> A declaration is either <StorageClasses(opt) BasicType Declarators> or
> <AutoDeclaration>. An AutoDeclaration is the one with type inference.
> And it is marked by any storage class, not just auto
> (http://dlang.org/declaration.html#AutoDeclaration): <StorageClasses
> AutoDeclarationX>. Well admittently
> http://dlang.org/declaration.html#StorageClass does not feature 'auto'
> as a storage class but this must be an error because the description of
> AutoDeclaration uses 'auto' in the place of StorageClasses.
> 
> It is just about grammar. A declaration needs a type, a storage class or
> both to not be mistaken for a statement with an assign expression. You
> use the 'auto' storage class so the statement cannot possibly be an
> expression when leaving out the type and not using any meaningful
> storage class.

`const int` works, so i can't see why `auto auto` is failing.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150605/d26818cc/attachment.sig>


More information about the Digitalmars-d mailing list