August 31 [Issue 24735] New: Enum is not work within the member function in the synchronized class | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24735 Issue ID: 24735 Summary: Enum is not work within the member function in the synchronized class Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: rayerd.wiz@gmail.com enum { ENUM1 = 1 } enum ENUM2 = 2; synchronized class A { void f() { auto a = ENUM1; // NG, but ENUM1 is constant. auto b = ENUM2; // OK } static void g() { auto c = ENUM1; // OK auto d = ENUM2; // OK } } void main() { A a = new A; a.f(); A.g(); } source\text.d(14,12): Error: direct access to shared `ENUM1` is not allowed, see `core.atomic` source\text.d(27,5): Error: `shared` method `text.A.f` is not callable using a non-shared object -- |
Copyright © 1999-2021 by the D Language Foundation