[Issue 343] New: Compile error using mixin containing struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 10 22:14:37 PDT 2006


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

           Summary: Compile error using mixin containing struct
           Product: D
           Version: 0.166
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: sean at f4.ca


Compiling:

    struct S
    {
        void* function(void*) fn;
    }

    template M()
    {
        S s;
    }

    void main()
    {
        mixin M;
    }

Gives:

    test.d(8): cannot implicitly convert expression (0) of type int to S
    test.d(8): cannot cast int to S
    test.d(8): cannot cast int to S

However, compiling:

    struct S
    {
        void* function(void*) fn;
    }

    template M()
    {
        S s = void;
    }

    void main()
    {
        mixin M;
    }

Works fine:

C:\code\src\d\test>dmd test
c:\bin\dmd\bin\..\..\dm\bin\link.exe test,,,user32+kernel32/noi;

C:\code\src\d\test>


-- 




More information about the Digitalmars-d-bugs mailing list