Thread overview
[Issue 284] New: Wrong type of template value parameter
Aug 12, 2006
d-bugmail
Aug 14, 2006
Thomas Kuehne
Aug 16, 2006
d-bugmail
August 12, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=284

           Summary: Wrong type of template value parameter
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: oskar.linde@gmail.com


struct A(int x) { }

template B(uint x) {
    static if (x == 3)
        static assert(is(A!(3) == A!(x)));
}

static this() { B!(3); }

---

file.d(5): static assert  (is(A  == A )) is false

---

Two instances of A!(3) is created. One with an int value type and the other one
with a uint(!) value type. The mangled forms are *__T1AVi3Z1A and *__T1AVk3Z1A
respectively.


-- 

August 14, 2006
d-bugmail@puremagic.com schrieb am 2006-08-12:
> http://d.puremagic.com/issues/show_bug.cgi?id=284

> struct A(int x) { }
>
> template B(uint x) {
>     static if (x == 3)
>         static assert(is(A!(3) == A!(x)));
> }
>
> static this() { B!(3); }
>
> ---
>
> file.d(5): static assert  (is(A  == A )) is false
>
> ---
>
> Two instances of A!(3) is created. One with an int value type and the other one
> with a uint(!) value type. The mangled forms are *__T1AVi3Z1A and *__T1AVk3Z1A
> respectively.

For the mangling aspect see http://d.puremagic.com/issues/show_bug.cgi?id=109

Thomas


August 16, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=284


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #2 from bugzilla@digitalmars.com  2006-08-15 23:42 -------
The generated template instance is based on the types of the arguments *before* they are implicitly converted to the template parameter type. This is deliberately designed this way so that new template specializations can be added without upsetting existing code. I adjusted the template documentation to clarify this point.

Not a bug.


--