www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1359] New: Can call non implemented functions

reply d-bugmail puremagic.com writes:
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 digitalmars.com
        ReportedBy: moritzwarning 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();
}


-- 
Jul 20 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1359






Created an attachment (id=169)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=169&action=view)
alternative testcase

This is another testcase that show that applications can silently change
behavior ,crash or just don't work only by switching the order of declaration
of two interfaces. It doesn't matter if the interfaces are defined in another
file.


-- 
Aug 11 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1359


Rainer Schuetze <r.sagitario gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario gmx.de



PDT ---
Seems to work fine with DMD 1.047 and DMD 2.032. I haven't tested the
additional alternative testcase, though (because of the tango usage).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2009
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1359


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED



Fixed in 1.029 or 1.030.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 18 2009