www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1731] New: forward reference of function type alias resets calling convention

reply d-bugmail puremagic.com writes:
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).


-- 
Dec 14 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1731






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


-- 
Apr 06 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1731


maxmo pochta.ru changed:

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





Subtle and disastrous bug, raising severity.


-- 
Apr 06 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1731




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: -------
Sep 23 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Sep 23 2009
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1731




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: -------
Sep 24 2009
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Oct 06 2009