www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1901] New: Structs with alias template params not accepted as types in declarations

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: dhasenan 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)


-- 
Mar 09 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1901


dhasenan gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|1.028                       |1.025





Noticed this in 1.025 as well; not sure how old it is.


-- 
Mar 09 2008