[Issue 23326] New: invariant syntax is inconsistently strict for annotations

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Sep 4 16:30:51 UTC 2022


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: nobody at puremagic.com
          Reporter: acehreli at yahoo.com

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.

--


More information about the Digitalmars-d-bugs mailing list