digitalmars.D - [Bug?] Attributes for invariant()
- Volodymyr (27/27) Mar 02 2015 class A
class A { private bool isA() const pure safe // OK { return true; } invariant() safe pure const // Error, statement block expected // safe pure const invariant() // OK { assert(isA); } } Does sufix-attribute style prohibited for invariant? Does it have any sence to mark it with this attributes? As for me invariant have to be const and pure by definition. Also: class A { invariant // Error: use 'immutable' instead of 'invariant' { assert(true); } } http://dlang.org/contracts.html#Invariants [compiled with http://dlang.org/]
Mar 02 2015