[Issue 4325] invariant syntax isn't strict

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 29 20:01:51 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4325


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich at gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-08-29 20:01:39 PDT ---
The compiler will still print an error if you add any statements below a class
invariant, e.g.:

struct Foo {
    invariant {}
}
struct Bar {
    int x = 5;
    invariant
        assert(x == 1);
}
class CFoo {
    invariant {}
}
class CBar {
    invariant
}
void main() 
{
    Bar bar;
}

bug4325.d(7): Declaration expected, not 'assert'


So it might not be that bad. The same thing happens if you put "const" "pure"
"immutable" without any opening braces or colons, e.g.:

struct Foo {
    pure
}
struct Bar {
    const
}
class CFoo {
    immutable
}
class CBar {
    invariant
}
void main() 
{
}

Compiles fine.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list