[Issue 21621] New: pragma(crt_constructor) accepts functions with parameters

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 9 08:15:43 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21621

          Issue ID: 21621
           Summary: pragma(crt_constructor) accepts functions with
                    parameters
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: bugzilla at digitalmars.com

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.

--


More information about the Digitalmars-d-bugs mailing list