Bug 1731 – forward reference of function type alias resets calling convention

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-12-14T19:28:00Z
Last change time
2014-02-24T15:33:32Z
Keywords
patch, wrong-code
Assigned to
nobody
Creator
dlang-bugzilla
Blocks
340, 2573

Attachments

IDFilenameSummaryContent-TypeSize
465export.patchevaluate forward referenced alias in correct scopetext/plain1486

Comments

Comment #0 by dlang-bugzilla — 2007-12-14T19:28:44Z
// == 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).
Comment #1 by dfj1esp02 — 2009-04-06T06:05:43Z
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);
Comment #2 by dfj1esp02 — 2009-04-06T06:10:18Z
Subtle and disastrous bug, raising severity.
Comment #3 by r.sagitario — 2009-09-23T14:03:37Z
Created attachment 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".
Comment #4 by r.sagitario — 2009-09-23T14:04:11Z
the patch is against dmd 2.032
Comment #5 by clugdbug — 2009-09-24T00:23:59Z
You're a legend! This was on my list of ten most worst bugs in DMD.
Comment #6 by bugzilla — 2009-10-06T02:13:17Z
Fixed dmd 1.048 and 2.033