On Fri, 05 Jun 2015 20:36:19 +0000, Mafi wrote:
> On Friday, 5 June 2015 at 10:56:36 UTC, ketmar wrote:
>
>
>> p.s. if "auto" is a storage class, the following code should be
>> accepted (while it isn't):
>>
>> int foo () { return 42; }
>>
>> void main () {
>> auto auto i = foo();
>> }
>>
>> as it's logically "an auto-typed var with "auto" storage class".
>
> Here lies your mistake. There is no such thing as "auto"-typed (leaving
> aside function signatures, which might be special-cased and are
> different beast altogether). Auto is not a type. auto* or auto[] aren't
> valied either. Auto is just a storage class, no more, no less. You use
> it if the grammar needs a storage class but you don't want to give
> special attributes to the variable (like const or static). To make a
> declaration with inferred type you need at least one storage class. To
> make it work with "normal" variables you use "auto".so either `const auto` should not be accepted, or `auto auto` should be accepted. if `auto` plays a role of "default storage class", the `const auto` should trigger the error about redundant storage specifier. if `auto` can play a role of type placeholder, then `auto auto` should be accepted, as it's clearly the "default storage class with type placeholder". current situation is inconsistent and that inconsistency must be fixed.
signature.asc
Description: PGP signature
