[Issue 15666] New: Grammar does not allow member function attributes on static constructors

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Feb 9 16:32:18 PST 2016


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

          Issue ID: 15666
           Summary: Grammar does not allow member function attributes on
                    static constructors
           Product: D
           Version: D2
          Hardware: All
               URL: http://dlang.org/spec/grammar.html
                OS: All
            Status: NEW
          Keywords: spec
          Severity: normal
          Priority: P1
         Component: dlang.org
          Assignee: nobody at puremagic.com
          Reporter: briancschott at gmail.com
            Blocks: 10233

StaticConstructor:
    static this ( ) ;
    static this ( ) FunctionBody

StaticDestructor:
    static ~ this ( ) MemberFunctionAttributesopt ;
    static ~ this ( ) MemberFunctionAttributesopt FunctionBody

SharedStaticConstructor:
    shared static this ( ) ;
    shared static this ( ) FunctionBody

SharedStaticDestructor:
    shared static ~ this ( ) MemberFunctionAttributesopt ;
    shared static ~ this ( ) MemberFunctionAttributesopt FunctionBody

According to the grammar static and shared static destructors can have
attributes, but constructors cannot.

The compiler, as well as the contributors to std.socket, seem to be unaware of
this fact:
https://github.com/D-Programming-Language/phobos/blob/5978ca7831443cec69430da6b3ccd315aae1878c/std/socket.d#L303

--


More information about the Digitalmars-d-bugs mailing list