[Issue 18549] New: name gets overwritten in template definition

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 2 21:38:54 UTC 2018


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

          Issue ID: 18549
           Summary: name gets overwritten in template definition
           Product: D
           Version: D2
          Hardware: x86_64
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: mephisto at nordhoff-online.de

$ dmd --version
DMD64 D Compiler v2.078.2


$ cat app.d
------
struct SS {}
struct tt {}

void tmpl( SS)() {}
void tmpl( tt)() {}

void main()
{
        tmpl!SS();
        tmpl!tt();
}
------



$ dmd app.d
------
sth.d(11): Error: sth.tmpl called with argument types () matches both:
sth.d(6):     sth.tmpl!(SS).tmpl()
and:
sth.d(7):     sth.tmpl!(SS).tmpl()
sth.d(12): Error: sth.tmpl called with argument types () matches both:
sth.d(6):     sth.tmpl!(tt).tmpl()
and:
sth.d(7):     sth.tmpl!(tt).tmpl()
------



although I figured out I can fix it by defining the templates like
`void tmpl( T : SS)() {}`, the compiler was using the same name for multiple
template-definitions.
Something must be wrong, I think

--


More information about the Digitalmars-d-bugs mailing list