[Issue 4237] New: Link error with typedefs of the same name in a function scope
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 26 12:35:21 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4237
Summary: Link error with typedefs of the same name in a
function scope
Product: D
Version: 2.041
Platform: x86
OS/Version: All
Status: NEW
Keywords: link-failure
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: rsinfu at gmail.com
--- Comment #0 from Shin Fujishiro <rsinfu at gmail.com> 2010-05-26 12:35:19 PDT ---
Typedefs in function scope don't get fully mangled with scope information. As
a result, the following code won't link:
-------------------- test.d
struct Struct(T)
{
T value;
}
void main()
{
{
typedef int Number = 1;
Struct!Number s;
pragma(msg, "1: ", typeof(s).mangleof);
}
{
typedef real Number = 2;
Struct!Number s;
pragma(msg, "2: ", typeof(s).mangleof);
}
}
--------------------
On Linux and FreeBSD:
--------------------
1: S4test20__T6StructTT6NumberZ6Struct
2: S4test20__T6StructTT6NumberZ6Struct
test.o(.rodata+0x18): multiple definition of `_Dmain6Number6__initZ'
test.o(.rodata+0x14): first defined here
--------------------
On Windows:
--------------------
1: S4test20__T6StructTT6NumberZ6Struct
2: S4test20__T6StructTT6NumberZ6Struct
OPTLINK (R) for Win32 Release 8.00.2
Copyright (C) Digital Mars 1989-2009 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
test.obj(test) Offset 0027DH Record Type 0091
Error 1: Previous Definition Different : _Dmain6Number6__initZ
--- errorlevel 1
--------------------
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list