www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3720] New: Taking address of member functions possible without an instance

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3720

           Summary: Taking address of member functions possible without an
                    instance
           Product: D
           Version: 2.039
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: tomeksowi gmail.com


--- Comment #0 from Tomasz SowiƄski <tomeksowi gmail.com> 2010-01-18 15:04:35
PST ---
struct S {
    int a;
    void fun() {
        this.a = 1;
    }
}

void main() {
    auto fp = &S.fun;
    fp();
}

Outputs:
object.Error: Access Violation


The solution is either to delegalize it or (better) include the hidden
parameter into the function pointer signature. So that &S.fun would be of type
void function(ref S).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 18 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3720


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |raphael.londeix gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2011-06-12 22:09:28 PDT ---
*** Issue 5986 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3720


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rayerd.wiz gmail.com


--- Comment #2 from yebblies <yebblies gmail.com> 2011-06-18 23:35:49 PDT ---
*** Issue 5328 has been marked as a duplicate of this issue. ***

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |suicidenet xited.de


--- Comment #3 from yebblies <yebblies gmail.com> 2011-07-12 02:44:12 EST ---
*** Issue 6287 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 11 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3720


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
                 CC|                            |yebblies gmail.com
            Version|2.039                       |D1 & D2


--- Comment #4 from yebblies <yebblies gmail.com> 2012-01-30 16:57:39 EST ---
Related to: Issue 2557 - inconsistent behavior when taking reference to member
without instance

This behavior encourages memory corruption.  At the least it should return
void*.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3720


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|nobody puremagic.com        |yebblies gmail.com


--- Comment #5 from yebblies <yebblies gmail.com> 2012-01-30 17:17:48 EST ---
Related to issue 2672.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 29 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3720


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wfunction hotmail.com


--- Comment #6 from yebblies <yebblies gmail.com> 2012-10-29 07:47:38 EST ---
*** Issue 8114 has been marked as a duplicate of this issue. ***

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