[Issue 2284] New: template is instantiated not properly when instantiated twise with different types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Aug 14 09:20:17 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2284
Summary: template is instantiated not properly when instantiated
twise with different types
Product: D
Version: unspecified
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: 2korden at gmail.com
I have the following code that does simple type checking:
void check(T)(T t)
{
writefln(T.mangleof);
writefln(typeof(t).mangleof);
writefln(T.sizeof);
writefln(typeof(t).sizeof);
writefln(T.stringof);
writefln(typeof(t).stringof);
}
It should output the same information twice, since is(typeof(t) == T) is true.
Let's run tests:
Test one:
check(42);
Output:
i
i
4
4
int
int
Test two:
check(0.0);
Output:
d
d
8
8
double
double
Ok so far. Test three:
check(42);
check(0.0);
Output:
i
i
4
4
int
int
d
i
8
4
double
int
Whoops! Results got mixed. Looks like typeof(t) returns wrong result now!
--
More information about the Digitalmars-d-bugs
mailing list