[Issue 9563] New: (2.062) typeof(T[0]) no longer works with array T's

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Feb 21 19:08:05 PST 2013


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

           Summary: (2.062) typeof(T[0]) no longer works with array T's
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: siegelords_abode at yahoo.com


--- Comment #0 from siegelords_abode at yahoo.com 2013-02-21 19:08:04 PST ---
Both invocations of ElemTypeOf used to work fine with DMD 2.061 but with DMD
2.062 only the class one works. Either none of them should work, or preferably
both should work as they had since D1:

template ElemTypeOf( T )
{
    alias typeof(T[0]) ElemTypeOf;
}

class A
{
    int opIndex(size_t i)
    {
        return 0;
    }
}

void main()
{
    ElemTypeOf!(A) a;
    ElemTypeOf!(int[]) b;

    static assert(is(typeof(a) == int));
    static assert(is(typeof(b) == int));
}

With dmd 2.062 the second invocation now gives the error:

test.d(3): Error: argument int[][0LU] to typeof is not an expression
test.d(3): Error: argument int[][0LU] to typeof is not an expression
test.d(17): Error: template instance test.ElemTypeOf!(int[]) error
instantiating
test.d(20): Error: static assert  (is(_error_ == int)) is false

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list