www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2284] New: template is instantiated not properly when instantiated twise with different types

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: 2korden 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!


-- 
Aug 14 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2284


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED





This was fixed in DMD1.039 when bug 2527 was fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 04 2009