September 05, 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@puremagic.com
        ReportedBy: dsimcha@yahoo.com


--- Comment #0 from David Simcha <dsimcha@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: -------
June 16, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4818


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |FIXED


--- Comment #1 from yebblies <yebblies@gmail.com> 2011-06-16 00:13:35 PDT ---
With dmd 2.053 this prints:

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

Which shows the delegate is being typed correctly.

shared(void delegate()) is not the same type as shared(void delegate() shared)

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