[Issue 4818] New: Taking address of shared member function -> unshared delegate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 5 08:35:02 PDT 2010


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

           Summary: Taking address of shared member function -> unshared
                    delegate
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2010-09-05 08:34:42 PDT ---
class Foo {

     shared void bar() {}
}

void main() {
     shared(void delegate()) d;
     auto foo = new Foo;
     d = &foo.bar;
} 

class Foo {

     shared void bar() {}
}

void main() {
     shared(void delegate()) d;
     auto foo = new Foo;
     d = &foo.bar;
} 

Error: cannot implicitly convert expression (&foo.bar) of type void
delegate() to shared(void delegate()) 


But this compiles:

class Foo {

     void bar() {}
}

void main() {
     shared(void delegate()) d;
     auto foo = new Foo;
     d = &foo.bar;
}

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