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

          Issue ID: 23326
           Summary: invariant syntax is inconsistently strict for
                    annotations
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: [email protected]
          Reporter: [email protected]

struct S {
  void foo() @nogc {}   // fine

  @nogc void foo() {}   // fine

  @nogc invariant() {}  // fine

  invariant() @nogc {}  /* compilation errors:
    Error: statement expected to be `{ }`, not `@`
    Error: basic type expected, not `{`
    Error: declaration expected, not `{`
                        */
}

That example uses @nogc but it's the same with other attributes like @safe,
pure, etc.

--

Reply via email to