Bug 19635 – -checkaction=context not working with attributes

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2019-01-30T21:37:47Z
Last change time
2019-03-12T12:01:44Z
Keywords
pull
Assigned to
No Owner
Creator
Jacob Carlborg

Comments

Comment #0 by doob — 2019-01-30T21:37:47Z
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
Comment #1 by greeenify — 2019-01-31T14:42:53Z
Comment #2 by Bastiaan — 2019-02-28T18:45:15Z
I am guessing this is the same issue, right? void func(void delegate()) {} void dum(){} void main() { import std.functional; func(toDelegate(&dum)); }
Comment #3 by greensunny12 — 2019-02-28T18:48:22Z
> I am guessing this is the same issue, right? Yup.
Comment #4 by dlang-bot — 2019-02-28T18:48:53Z
@wilzbach updated dlang/druntime pull request #2479 "Fix Issue 19635 - -checkaction=context not working with attributes" fixing this issue: - Fix Issue 19635 - -checkaction=context not working with attributes https://github.com/dlang/druntime/pull/2479
Comment #5 by dlang-bot — 2019-03-12T12:01:44Z
dlang/druntime pull request #2479 "Fix Issue 19635 - -checkaction=context not working with attributes" was merged into stable: - 6c99566a33dbf356fd376b0153c4b474019116a6 by Sebastian Wilzbach: Fix Issue 19635 - -checkaction=context not working with attributes https://github.com/dlang/druntime/pull/2479