[Issue 12710] New: Bad @nogc requirement for Windows callbacks
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue May 6 03:57:01 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12710
Issue ID: 12710
Summary: Bad @nogc requirement for Windows callbacks
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Severity: regression
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: thecybershadow at gmail.com
////////////////////// test.d /////////////////////
import core.sys.windows.windows;
extern(Windows)
LRESULT wndProc(HWND, UINT, WPARAM, LPARAM) nothrow
{
return 0;
}
void main()
{
WNDCLASSW c;
c.lpfnWndProc = &wndProc;
RegisterClassW(&c);
}
///////////////////////////////////////////////////
The above no longer compiles. For some reason lpfnWndProc is now required to be
@nogc, which makes no sense, as the callback is called from within the same
thread and is allowed to interact freely with the GC.
A cast is now required, which is not very safe since the cast may subtly allow
an incorrect callback signature or calling convention.
--
More information about the Digitalmars-d-bugs
mailing list