www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21623] New: pragma(crt_constructor) should accept function


          Issue ID: 21623
           Summary: pragma(crt_constructor) should accept function
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com


    extern (C)
    pragma(crt_constructor) void foo();

This code silently compiles, but does nothing, while:

    extern (C)
    pragma(crt_constructor) void foo() { }

compiles and calls foo() on startup.

There is no reason the former should not work, and to silently do nothing at
minimum is a bug.

Feb 09 2021