www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 343] New: Compile error using mixin containing struct

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


-- 
Sep 10 2006
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-09-11:
 http://d.puremagic.com/issues/show_bug.cgi?id=343

 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

<snip> Added to DStress as http://dstress.kuehne.cn/run/m/mixin_24_A.d http://dstress.kuehne.cn/run/m/mixin_24_B.d http://dstress.kuehne.cn/run/m/mixin_24_C.d http://dstress.kuehne.cn/run/m/mixin_24_D.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFFCIcILK5blCcjpWoRAosUAJ42rGe/PqM3TmJth0t+oau8WSiAsgCgib8K CPAnv5ixLRaOVs+oQ+5hBrc= =AOH5 -----END PGP SIGNATURE-----
Sep 13 2006
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=343


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #2 from bugzilla digitalmars.com  2006-11-25 03:28 -------
Fixed DMD 0.175


-- 
Nov 25 2006