Thread overview
[Issue 1731] New: forward reference of function type alias resets calling convention
Dec 15, 2007
d-bugmail
Apr 06, 2009
d-bugmail
Apr 06, 2009
d-bugmail
Sep 23, 2009
Rainer Schuetze
Sep 23, 2009
Rainer Schuetze
Sep 24, 2009
Don
Oct 06, 2009
Walter Bright
December 15, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1731

           Summary: forward reference of function type alias resets calling
                    convention
           Product: D
           Version: 1.024
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: thecybershadow@gmail.com


// == minimal testcase start ==
alias uint DWORD;
MY_API_FUNCTION lpStartAddress;  // <-- comment this line to remove error
extern (Windows) alias DWORD function(void*) MY_API_FUNCTION;
static assert(MY_API_FUNCTION.stringof == "uint(Windows *)(void*)");
// == minimal testcase end ==

The actual calling convention (MY_API_FUNCTION.stringof) is "uint(*)(void*)".
This is from a real-life case (the Windows header project).


-- 

April 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1731





------- Comment #1 from maxmo@pochta.ru  2009-04-06 06:05 -------
For dmd 2.023

alias uint DWORD;
MY_API_FUNCTION lpStartAddress;  // <-- comment this line to remove error
extern (Windows) alias DWORD function(void*) MY_API_FUNCTION;
static assert(MY_API_FUNCTION.stringof == "uintWindows  function(void*)",
MY_API_FUNCTION.stringof);


-- 

April 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1731


maxmo@pochta.ru changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical




------- Comment #2 from maxmo@pochta.ru  2009-04-06 06:10 -------
Subtle and disastrous bug, raising severity.


-- 

September 23, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1731



--- Comment #3 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-23 14:03:37 PDT ---
Created an attachment (id=465)
evaluate forward referenced alias in correct scope

The forward reference to the alias causes its semantic analysis to be run from the scope of the variable declaration, omitting the "extern(Windows)" attribute. The patch uses the scope of the symbol (which happens to already exist) instead of the current scope.

The patch also fixes the bad spacing "uintWindows".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 23, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1731


Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |r.sagitario@gmx.de


--- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> 2009-09-23 14:04:11 PDT ---
the patch is against dmd 2.032

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 24, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1731



--- Comment #5 from Don <clugdbug@yahoo.com.au> 2009-09-24 00:23:59 PDT ---
You're a legend! This was on my list of ten most worst bugs in DMD.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 06, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1731


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #6 from Walter Bright <bugzilla@digitalmars.com> 2009-10-06 02:13:17 PDT ---
Fixed dmd 1.048 and 2.033

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