[Issue 12674] New: alias parameter does not accept specAlias and defaultAlias when both are types
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Mon Apr 28 11:47:38 PDT 2014
    
    
  
https://issues.dlang.org/show_bug.cgi?id=12674
          Issue ID: 12674
           Summary: alias parameter does not accept specAlias and
                    defaultAlias when both are types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrej.mitrovich at gmail.com
-----
template TemplVals(
    alias AliasParamSpecVal : 1,
    alias AliasParamDefaultVal = 1,
    alias AliasParamSpecDefaultVal : 1 = 2,
) { }
template TemplTypes(
    alias AliasParamSpecType : int,
    alias AliasParamDefaultType = int,
    alias AliasParamSpecDefaultType : long = int,  // syntax error
) { }
void main()
{
    alias a = TemplVals!(1, 1, 1);  // ok
    alias b = TemplVals!(1);  // ok
    alias c = TemplTypes!(int, int, int);  // should be ok
    alias d = TemplTypes!(int);  // should be ok
}
-----
Note that Type parameters work for the above test:
-----
template TemplVals(
    alias AliasParamSpecVal : 1,
    alias AliasParamDefaultVal = 1,
    alias AliasParamSpecDefaultVal : 1 = 2,
) { }
template TemplTypes(
    /* alias */ TypeParamSpecType : int,
    /* alias */ TypeParamDefaultType = int,
    /* alias */ TypeParamSpecDefaultType : long = int,
) { }
void main()
{
    alias a = TemplVals!(1, 1, 1);  // ok
    alias b = TemplVals!(1);  // ok
    alias c = TemplTypes!(int, int, int);  // ok
    alias d = TemplTypes!(int);  // ok
}
-----
--
    
    
More information about the Digitalmars-d-bugs
mailing list