[Issue 5328] New: The addressof-expression that should be rejected is accepted

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 6 08:57:59 PST 2010


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

           Summary: The addressof-expression that should be rejected is
                    accepted
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: rayerd.wiz at gmail.com


--- Comment #0 from Haruki Shigemori <rayerd.wiz at gmail.com> 2010-12-06 08:56:21 PST ---
// a.d
void f(void function() m) { m(); }

class A
{
    this()
    {
        f(&A.m); // rejects-invalid => OK
    }

    /+static+/ void m() {}
}

void main()
{
    f(&A.m); // accepts-invalid => BAD!!
}

$ dmd a.d
a.d(7): Error: function a.f (void function() m) is not callable using argument
types (void delegate())
a.d(7): Error: cannot implicitly convert expression (&this.A.m) of type void
delegate() to void function()

You will get the following result if you remove A.this constructor.

$ dmd a.d
object.Error: Access Violation

-- 
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