Bug 21621 – pragma(crt_constructor) accepts functions with parameters

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-02-09T08:15:43Z
Last change time
2024-12-13T19:14:33Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=21622, https://issues.dlang.org/show_bug.cgi?id=21623, https://issues.dlang.org/show_bug.cgi?id=23535
Moved to GitHub: dmd#19868 →

Comments

Comment #0 by bugzilla — 2021-02-09T08:15:43Z
These functions cannot have parameters, because they are called by the runtime which has no way to give a parameter. But the error is not diagnosed: extern (C) pragma(crt_constructor) void foo(int i) { } // has parameter struct S { extern (C) pragma(crt_constructor) void bar() { } // has `this` } Probably pragma(crt_destructor) has the same problem.
Comment #1 by robert.schadek — 2024-12-13T19:14:33Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19868 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB