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.
Works with current D2 (2.058). This is a duplicate, I just don't know where the other bug report is.