Bug 520 – Invariants allowed to call public functions

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-11-15T07:40:00Z
Last change time
2014-02-15T13:21:55Z
Keywords
accepts-invalid, spec
Assigned to
bugzilla
Creator
matti.niemenmaa+dbugzilla
Depends on
9412
Blocks
511

Comments

Comment #0 by matti.niemenmaa+dbugzilla — 2006-11-15T07:40:40Z
This is similar to Issue 516. The following code is directly from the spec: class Foo { public void f() { } private void g() { } invariant { f(); // error, cannot call public member function from invariant g(); // ok, g() is not public } } According to the comments in the code and a paragraph in the spec the above should fail to compile, yet it compiles fine (and, due to Issue 519, runs fine, instead of falling to stack overflow). The compiler shouldn't allow this, as there is no situation where this is useful: it's always an infinite loop.
Comment #1 by bugzilla — 2008-07-09T22:33:28Z
Fixed dmd 1.032 and 2.016