[Issue 1901] New: Structs with alias template params not accepted as types in declarations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 9 16:31:48 PDT 2008


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

           Summary: Structs with alias template params not accepted as types
                    in declarations
           Product: D
           Version: 1.028
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: dhasenan at gmail.com


A parse error, apparently:

struct Test(alias test)
{
    void run() { test(); }
}

struct Something(char[] s)
{
    char[] name () { return s; }
}

alias Test!({ Stdout("test!").newline; }) test; // fine

void main()
{
    Something!(`hello`) thing; // fine
    test t; // fine
    Test!({ Stdout("test!").newline; }) z; // fail, error:
    //plan.d(30): found 'z' when expecting ';' following 'statement'
}

I was hoping to use this means as a brief way of declaring unit tests in an
xUnit-like system (and iterate through them using .tupleof)


-- 



More information about the Digitalmars-d-bugs mailing list