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: [email protected]
Reporter: [email protected]
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().
--