August 19, 2019 [Issue 20142] New: Reading member of enum considered modifying access | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20142 Issue ID: 20142 Summary: Reading member of enum considered modifying access Product: D Version: D2 Hardware: All OS: Linux Status: NEW Severity: regression Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: rschadek@symmetryinvestments.com This fails to compile with ``` import std.array : empty; struct Foo { string text; } Foo getFoo() { return Foo("Hello World"); } void main() { enum Foo foo = getFoo(); assert(!foo.text.empty); } ``` (13): Error: cannot modify constant expression Foo("Hello World").text -- |
Copyright © 1999-2021 by the D Language Foundation