Bug 2015 – Interface template methods are allowed

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2008-04-19T13:53:00Z
Last change time
2014-02-24T15:33:30Z
Keywords
accepts-invalid
Assigned to
bugzilla
Creator
dvdfrdmn

Comments

Comment #0 by dvdfrdmn — 2008-04-19T13:53:38Z
Compiler allows the following: -- class X { void f(T)() { } } void main() { (new X).f!(int)(); } -- This is due (at least partially) to the use of toParent() instead of toParent2() to in FuncDeclaration::semantic, FuncDeclaration::isVirtual, and Dsymbol::isMember.
Comment #1 by kamm-removethis — 2008-04-19T14:30:48Z
Maybe add the implementation hint to bug 566 as well. *** This bug has been marked as a duplicate of 566 ***
Comment #2 by dvdfrdmn — 2008-04-19T16:14:00Z
This actually came from a SourceForge bug report. The original specifies interface methods. In this case, the code fails to link, but there should be a proper error message. ---- interface TestInterface { void tpl(T)(); } class TestImplementation : TestInterface { void tpl(T)() { } } void main() { /* TestImplementation t = new TestImplementation(); // works */ TestInterface t = new TestImplementation(); // fails t.tpl!(int)(); } ---
Comment #3 by dvdfrdmn — 2008-04-19T16:17:11Z
Oops, didn't realize 566 was still open. *** This bug has been marked as a duplicate of 566 ***