www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1215] New: Alias of a indexed tuple's field isn't allowed

http://d.puremagic.com/issues/show_bug.cgi?id=1215

           Summary: Alias of a indexed tuple's field isn't allowed
           Product: D
           Version: 1.014
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: reiner.pope gmail.com


The following code doesn't compile:
template Foo(T...)
{
    alias T[0].TheType MyType;
//  Above gives error:
//    alias.d(3): no identifier for declarator T[0]
//    alias.d(3): semicolon expected to close alias declaration
}

struct Bar
{
    alias int TheType;
}

alias Foo!(Bar) FooInstance;


But replacing the alias in line 3 with the following code fixes it:
    alias T[0] TheElem;
    alias TheElem.TheType MyType;


-- 
May 06 2007