[Issue 1359] New: Can call non implemented functions
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 20 16:15:02 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1359
Summary: Can call non implemented functions
Product: D
Version: 1.018
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: moritzwarning at web.de
In this following example we can call Foo.get
even it is not implemented.
The program compiles and runs without problems, but shouldn't.
When Foo.get is implemented it also never get called.
The compiler recognizes the bug when the return type
for get isn't a template or interfaces Node and Nodes
changes places.
module Main;
class Bar(T)
{
}
//program compiles but crashes when interface is empty
interface Node : Nodes
{
void print();
}
interface Nodes
{
public:
Bar!(Node) get();
}
class Foo : Node
{
public:
void print() { }
/*
//never get called when implemented
Bar!(Node) get()
{
return null;
}
*/
}
void main(char[][] args)
{
Node foo = new Foo;
foo.get();
}
--
More information about the Digitalmars-d-bugs
mailing list