https://issues.dlang.org/show_bug.cgi?id=18725
Issue ID: 18725 Summary: compiler does not check all levels of methods for privateness, if used in invariant Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: sascha.or...@gmail.com Given this ´´´ void main() { auto s = S(); assert(&s); } struct S { invariant { assert(fun); } size_t[] member; private bool fun() const { return fun1(); } /*private*/ bool fun1() const { return true; } } ´´´ The code compiles with or without privateness of fun1. However, if the privateness for fun1 is missing the run yields a segmentation fault, while when it is present, the result is as expected. If privateness for fun is missing, the compiler complains about using it in the invariant, as expected. --