November 15, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=520

           Summary: Invariants allowed to call public functions
           Product: D
           Version: 0.174
          Platform: PC
               URL: http://www.digitalmars.com/d/class.html#invariants
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid, spec
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: deewiant@gmail.com
OtherBugsDependingO 511
             nThis:


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.


-- 

July 10, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=520


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from bugzilla@digitalmars.com  2008-07-09 22:33 -------
Fixed dmd 1.032 and 2.016


--