September 11 [Issue 24762] New: @nogc false positive error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24762 Issue ID: 24762 Summary: @nogc false positive error Product: D Version: D2 Hardware: All URL: http://dlang.org/ OS: All Status: NEW Severity: major Priority: P3 Component: dmd Assignee: nobody@puremagic.com Reporter: eyal@weka.io struct S { int m; } string m() { return "m"; } @nogc void f() { S s; auto x = __traits(getMember, s, m()); // Error: `@nogc` function `nogc.f` cannot call non-@nogc function `nogc.m` } Of course, this can be worked around with: enum M = m(); auto x = __traits(getMember, s, M); But the m() call is in compile-time, and should not relate to the runtime @nogc enforcement inside f(). -- |
Copyright © 1999-2021 by the D Language Foundation