www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 15666] New: Grammar does not allow member function attributes

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

--
Feb 09 2016