www.digitalmars.com         C & C++   DMDScript  

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

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

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

Consider:

    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