[Issue 18757] New: static invariant{} should either work or not be valid syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 12 13:15:37 UTC 2018


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

          Issue ID: 18757
           Summary: static invariant{} should either work or not be valid
                    syntax
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: default_357-line at yahoo.de

Right now, you can define a struct to have a static invariant:

struct S {
  static invariant { assert(false); }
  static void foo() { }
}

But the invariant will not be checked when calling foo.

Either this should work, or "static invariant {}" should be a syntax error.

--


More information about the Digitalmars-d-bugs mailing list