www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21621] New: pragma(crt_constructor) accepts functions with

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 puremagic.com
          Reporter: bugzilla 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.

--
Feb 09 2021