Bug 3563 – Enum values returned by ref from a function trigger compiler error.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2009-12-01T15:19:00Z
Last change time
2012-02-20T00:10:09Z
Keywords
rejects-valid
Assigned to
nobody
Creator
e.insafutdinov
Comments
Comment #0 by e.insafutdinov — 2009-12-01T15:19:15Z
The following code:
enum Foo { A, B }
Foo x = Foo.A;
ref Foo bar()
{
return x;
}
ref const(Foo) baz()
{
return bar();
}
results in compiler error:
bug.d(12): Error: bar() is not mutable
If you replace Foo with int - the bug disappears.
Comment #1 by yebblies — 2012-02-20T00:10:09Z
Works with current D2 (2.058).
This is a duplicate, I just don't know where the other bug report is.