[Bug 36] New: Odd enum forward-reference (?) alias bug

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 11 09:41:04 PST 2006


http://d.puremagic.com/bugzilla/show_bug.cgi?id=36

           Summary: Odd enum forward-reference (?) alias bug
           Product: D
           Version: 0.149
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: braddr at puremagic.com
        ReportedBy: jarrett.billingsley at gmail.com


This is an obscure one.

This code compiles, as expected:

enum E
{
        One,
        Two,
        Three
}

class A
{
        alias void delegate(E) EDG;

        static void fork(EDG dg)
        {
                dg(E.One);
        }
}

But move the alias declaration after the function:

class A
{
        static void fork(EDG dg)
        {
                dg(E.One);
        }

        alias void delegate(E) EDG;
}

And you get the cryptic error:

dtest.d(18): cannot implicitly convert expression (0) of type E to E

Maybe this has something to do with forward referencing?


-- 




More information about the Digitalmars-d-bugs mailing list