digitalmars.D.bugs - [Issue 18407] New: debug should escape nothrow nogc safe (not just
- d-bugmail puremagic.com (57/57) Feb 08 2018 https://issues.dlang.org/show_bug.cgi?id=18407
https://issues.dlang.org/show_bug.cgi?id=18407 Issue ID: 18407 Summary: debug should escape nothrow nogc safe (not just pure) Product: D Version: D2 Hardware: x86 OS: Mac OS X Status: NEW Severity: major Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: timothee.cour2 gmail.com ``` void fun_nogc() nogc{ debug{ auto a1=new int(1); // Error: cannot use 'new' in nogc function 'main.fun' } } void fun_nothrow() nothrow{ debug{ static int a; import std.exception; enforce(a==0); // Error: function std.exception.enforce!(Exception, bool).enforce is not nothrow } } static int temp(){ static int a=0; a++; return a; } int fun_pure() pure{ int ret; debug{ ret+=temp; // ok this works static int a2=0; a2++; ret+=a2; } return ret; } void fun_safe() safe{ debug{ int []a=[1]; if(false) a.ptr[0]++; // Error: a.ptr cannot be used in safe code, use &a[0] instead } } void main(){ fun_nogc; fun_nothrow; fun_pure; fun_safe; } ``` --
Feb 08 2018