[Issue 10326] Disallow 'invariant' for immutable, allow class/struct invariants without (), and later disallow usage of ()

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat May 17 03:23:11 PDT 2014


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

--- Comment #9 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to bearophile_hugs from comment #6)
> I'd like to reopen this issue because it's not done yet. The last missing
> step is to (in future) give an error in line 2 of program, disallowing the
> () after invariant:
> 
> 
> struct Foo {
>     invariant() {
>         assert(false);
>     }
>     void bar() {}
> }
> unittest() {} // Not allowed.
> void main() {
>     Foo f;
>     f.bar;
> }

Instead of that, how about to accept both invariant(){...}  and unittest(){...}
?

--


More information about the Digitalmars-d-bugs mailing list