[Issue 23375] New: enum is not considered global mutable state
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 26 09:42:03 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23375
Issue ID: 23375
Summary: enum is not considered global mutable state
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
An enum of slice of class can be mutated and it can be mutated even in a `pure`
function.
Example:
class C
{
string s;
this(string a) pure @safe nothrow { s = a; }
}
enum C[] cs = [ new C("a"), new C("b") ];
void f() pure @safe @nogc nothrow
{
cs[0].s = "c";
}
--
More information about the Digitalmars-d-bugs
mailing list