Code behaves incorrectly if it is compiled in std.functional
Mafi via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jun 5 09:42:25 PDT 2015
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.
More information about the Digitalmars-d
mailing list