March 26, 2006
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.


-- 

April 01, 2006
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