[Issue 24735] New: Enum is not work within the member function in the synchronized class
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 31 04:51:39 UTC 2024
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 at puremagic.com
Reporter: rayerd.wiz at 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
--
More information about the Digitalmars-d-bugs
mailing list