[Issue 18549] name gets overwritten in template definition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 4 16:59:02 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18549

ag0aep6g at gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |ag0aep6g at gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from ag0aep6g at gmail.com ---
(In reply to Johannes Nordhoff from comment #0)
> struct SS {}
> struct tt {}
> 
> void tmpl( SS)() {}
> void tmpl( tt)() {}

The template parameters SS and tt have no relation to the structs of the same
name. You could write it like this with the exact same meaning:

----
struct SS {}
struct tt {}

void tmpl(Foo)() {}
void tmpl(Bar)() {}
----

You've got two identical templates with the same name "tmpl". Any attempt at
instantiating tmpl will match both (or neither). The error messages you get
look fine to me.

I'm closing as INVALID, because it looks like you misunderstood how the
template parameter names relate to the struct names.

[...]
> the compiler was using the same name for multiple
> template-definitions.

I don't understand what you mean by this. If you still think the compiler
should do something differently here, please feel free to reopen.

--


More information about the Digitalmars-d-bugs mailing list