digitalmars.D.bugs - [Issue 20507] New: Debug statements affect inference of templated
- d-bugmail puremagic.com (43/43) Jan 15 2020 https://issues.dlang.org/show_bug.cgi?id=20507
https://issues.dlang.org/show_bug.cgi?id=20507 Issue ID: 20507 Summary: Debug statements affect inference of templated functions attributes Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: moonlightsentinel disroot.org debug statements are allowed to violate safe, pure, nogc and nothrow (allthough the latter is not implemented right now). But they influence the attribute interference: ---------------------------------------------- void main() pure /* nothrow */ safe nogc { debug foo(); bar!()(); } void foo() system { // Just to be sure its neither nogc, pure or nothrow __gshared int counter = 0; if (counter++) throw new Exception(new immutable(char)[counter]); } void bar()() { debug foo(); } ---------------------------------------------- ..\debugging.d(4): Error: safe function D main cannot call system function debugging.bar!().bar ..\debugging.d(16): debugging.bar!().bar is declared here ..\debugging.d(4): Error: nogc function D main cannot call non- nogc function debugging.bar!().bar ---------------------------------------------- The debug statement caused bar to become system, non- nogc and non-nothrow. --
Jan 15 2020