[Issue 9412] New: Invariants allowed to call public functions indirectly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 27 21:34:56 PST 2013


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

           Summary: Invariants allowed to call public functions indirectly
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, spec
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kekeniro2 at yahoo.co.jp
            Blocks: 520


--- Comment #0 from kekeniro2 at yahoo.co.jp 2013-01-27 21:34:53 PST ---
Invariants are not allowed to call public functions _directly_.(Issue 520)
However, they can do indirectly, and that makes an infinite loop.

Code:
//import std.stdio; // for trace log
class Inv {
    invariant() {
        //writeln("invariant");
        prv();
        //pub(); // not allowed
    }
    private void prv() const {
        //writeln("private");
        pub();
    }
    void pub() const {
        //writeln("public");
    }
}
void main() {
    auto test = new Inv();
    test.pub();
}

-- 
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