2015 – Interface template methods are allowed

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 2015 - Interface template methods are allowed
Summary: Interface template methods are allowed
Status: RESOLVED DUPLICATE of issue 566
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D1 (retired)
Hardware: All All
: P2 normal
Assignee: Walter Bright
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
Reported: 2008年04月19日 13:53 UTC by David Friedman
Modified: 2014年02月24日 15:33 UTC (History)
0 users

See Also:


Attachments
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description David Friedman 2008年04月19日 13:53:38 UTC
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 Christian Kamm 2008年04月19日 14:30:48 UTC
Maybe add the implementation hint to bug 566 as well.
*** This bug has been marked as a duplicate of 566 ***
Comment 2 David Friedman 2008年04月19日 16:14:00 UTC
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 David Friedman 2008年04月19日 16:17:11 UTC
Oops, didn't realize 566 was still open.
*** This bug has been marked as a duplicate of 566 ***


AltStyle によって変換されたページ (->オリジナル) /