www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5167] New: argument to function expecting a C callback parameter isn't checked for linkage type

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

           Summary: argument to function expecting a C callback parameter
                    isn't checked for linkage type
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: mrmocool gmx.de


--- Comment #0 from Trass3r <mrmocool gmx.de> 2010-11-05 04:55:30 PDT ---
extern(C)
{
    alias /* extern(C)*/ void function() ft;
    void func(ft fp)
    {
        fp();
    }
}

void foo()
{
}

void main()
{
    func(&foo);
}

This compiles just fine even though foo has improper linkage.
I guess this could yield a corrupt stack when used with a C library.

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |yebblies gmail.com


--- Comment #1 from yebblies <yebblies gmail.com> 2010-11-05 19:07:48 PDT ---
See http://d.puremagic.com/issues/show_bug.cgi?id=3797

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 05 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5167


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


--- Comment #2 from yebblies <yebblies gmail.com> 2011-06-08 00:48:14 PDT ---
*** This issue has been marked as a duplicate of issue 3797 ***

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