Thread overview
[Issue 8464] New: debug too strict from function attributes
Jul 29, 2012
Era Scarecrow
Jul 29, 2012
Walter Bright
July 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8464

           Summary: debug too strict from function attributes
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: rtcvb32@yahoo.com


--- Comment #0 from Era Scarecrow <rtcvb32@yahoo.com> 2012-07-29 13:30:35 PDT ---
If a function is @safe then the debug {} calls all remain required to also follow that requirement as well.

void pureSafe() @safe pure {
    debug {
        writeln("Debugging info!");
    }
}
Error: safe function 'pureSafe' cannot call system function 'writeln'

 Marking the function as @trusted (although works) when the non-debug code is
provably @safe seems like a bad approach just for debugging. Debug scope should
break constraints and limitations for debugging purposes.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8464


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
           Severity|major                       |enhancement


--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> 2012-07-29 13:59:30 PDT ---
Not a bad idea, but it's an enhancement.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8464


monarchdodra@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |monarchdodra@gmail.com


--- Comment #2 from monarchdodra@gmail.com 2013-08-20 08:48:31 PDT ---
*** Issue 10854 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
August 20, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=8464



--- Comment #3 from monarchdodra@gmail.com 2013-08-20 08:50:00 PDT ---
(In reply to comment #2)
> *** Issue 10854 has been marked as a duplicate of this issue. ***

I also think that @safe can call anything in a debug clause.

Consider also making debug callable in a nothrow scope, even if the debug code can throw.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------