www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Bug 75] New: Template aliases in unittests (incorrect code generation)

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/bugzilla/show_bug.cgi?id=75

           Summary: Template aliases in unittests (incorrect code
                    generation)
           Product: D
           Version: 0.148
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: nail-mail mail.ru


I have 2 modules:

=== mod.d ===


module mod;

struct Dummy
{
}

struct TemplatedStruct(Param)
{
        static real f = 0;
}

unittest
{
        alias TemplatedStruct!(Dummy) X;        
}

=== test.d === 

import mod;

int main(char[][] args)
{
        TemplatedStruct!(Dummy) e;

        return 0;
}


I compile them with -g -unittest -debug one by one into 2 .obj files, then I
link them together. All compiles and links fine, but on attempt to run
application I've got 'D:\devel\dtest\test.exe is not valid Win32 application'
msg box and 'Access is denied.' in command window.

If I'll comment out alias in unittest, or move it outside unittest, or merge
modules into one, or remove `static real f` in TemplatedStruct -- eror would go
away.


-- 
Mar 26 2006
parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

d-bugmail puremagic.com schrieb am 2006-03-26:
 http://d.puremagic.com/bugzilla/show_bug.cgi?id=75
 I have 2 modules:

=== mod.d ===


 module mod;

 struct Dummy
 {
 }

 struct TemplatedStruct(Param)
 {
         static real f = 0;
 }

 unittest
 {
         alias TemplatedStruct!(Dummy) X;        
 }

=== test.d === 

 import mod;

 int main(char[][] args)
 {
         TemplatedStruct!(Dummy) e;

         return 0;
 }


 I compile them with -g -unittest -debug one by one into 2 .obj files, then I
 link them together. All compiles and links fine, but on attempt to run
 application I've got 'D:\devel\dtest\test.exe is not valid Win32 application'
 msg box and 'Access is denied.' in command window.

 If I'll comment out alias in unittest, or move it outside unittest, or merge
 modules into one, or remove `static real f` in TemplatedStruct -- eror would go
 away.
Added to DStress as http://dstress.kuehne.cn/complex/unittest_09 http://dstress.kuehne.cn/run/u/unittest_09_E.d http://dstress.kuehne.cn/run/u/unittest_09_F.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFELlUO3w+/yD4P9tIRAgtdAJ9B6p+vqOpAruOY+GngKH5X3NYpdgCcDc8A QtELcx7NrV/w9zjJOhF6AMc= =eG6G -----END PGP SIGNATURE-----
Apr 01 2006