[Issue 21414] New: Spurious "non-constant expression" error with immutable constructors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 22 02:42:26 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21414
Issue ID: 21414
Summary: Spurious "non-constant expression" error with
immutable constructors
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: rejects-valid
Severity: regression
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: dlang-bugzilla at thecybershadow.net
//////////////////// test.d ///////////////////
struct State
{
string s;
immutable this(string s)
{
this.s = s;
}
}
// Error: non-constant expression "b"[]
immutable rootState = new immutable State("b");
///////////////////////////////////////////////
Works OK if you remove the constructor.
Works OK if you remove "immutable" (and make rootState __gshared).
Seems to be a regression, introduced in
https://github.com/dlang/dmd/pull/4719
--
More information about the Digitalmars-d-bugs
mailing list