www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12802] New: Allow optional 'StorageClasses' for new alias

https://issues.dlang.org/show_bug.cgi?id=12802

          Issue ID: 12802
           Summary: Allow optional 'StorageClasses' for new alias syntax
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

Old style alias declaration can have optional 'StorageClasses'.

alias extern(C) ref pure nothrow int function() FP;
pragma(msg, FP);  // prints: extern (C) int function() pure nothrow ref

But new alias syntax (introduced in enhancement issue 3011) does not support
it.

alias FP = extern(C) ref pure nothrow int function();
---
test.d(1): Error: basic type expected, not extern
test.d(1): Error: semicolon expected to close alias declaration
test.d(1): Error: no identifier for declarator extern (C) int function()

The latter syntax should also be accepted and have same semantics with the
former.

--
May 25 2014