www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19635] New: -checkaction=context not working with attributes

https://issues.dlang.org/show_bug.cgi?id=19635

          Issue ID: 19635
           Summary: -checkaction=context not working with attributes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: doob me.com

The new "-checkaction=context" flag available in master doesn't work with
attributes like  safe,  nogc or "pure". Example:

void main()  safe pure  nogc
{
    int a;
    assert(a == 0);
}

The above code fails to compile with the following errors:

Error: pure function D main cannot call impure function
object._d_assert_fail!("==", int, int)._d_assert_fail
main.d(1): Error:  safe function D main cannot call  system function
object._d_assert_fail!("==", int, int)._d_assert_fail
./generated/osx/release/64/../../../../../druntime/import/object.d(4822):      
 object._d_assert_fail!("==", int, int)._d_assert_fail is declared here
main.d(1): Error:  nogc function D main cannot call non- nogc function
object._d_assert_fail!("==", int, int)._d_assert_fail

--
Jan 30