Bug 75 – Template aliases in unittests (incorrect code generation)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-03-26T07:13:00Z
Last change time
2014-02-14T20:33:34Z
Keywords
wrong-code
Assigned to
bugzilla
Creator
nail-mail
Comments
Comment #0 by nail-mail — 2006-03-26T07:13:21Z
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.
Comment #1 by thomas-dloop — 2006-04-01T14:30:27Z
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[email protected] 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_09http://dstress.kuehne.cn/run/u/unittest_09_E.dhttp://dstress.kuehne.cn/run/u/unittest_09_F.d
Thomas
-----BEGIN PGP SIGNATURE-----
iD8DBQFELlUO3w+/yD4P9tIRAgtdAJ9B6p+vqOpAruOY+GngKH5X3NYpdgCcDc8A
QtELcx7NrV/w9zjJOhF6AMc=
=eG6G
-----END PGP SIGNATURE-----