[Issue 6287] New: function pointers to non-static function without an object-instance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 11 09:37:24 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6287

           Summary: function pointers to non-static function without an
                    object-instance
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: suicidenet at xited.de


--- Comment #0 from suicidenet at xited.de 2011-07-11 09:32:15 PDT ---
----
import std.stdio;

struct test
{
    int foo(int k) //forgot to defined as static
    {
        return k;
    }
}

int main(string[] argv)
{
    int function(int) fp;

    fp = &test.foo; //this should not be possible, as foo is not static. it
allows dirty hacks, though.
    int x = fp(99);
    writeln(x);    
   return 0;
}
----

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


More information about the Digitalmars-d-bugs mailing list