D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3563 - Enum values returned by ref from a function trigger compiler error.
Summary: Enum values returned by ref from a function trigger compiler error.
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2009-12-01 15:19 UTC by Eldar Insafutdinov
Modified: 2012-02-20 00:10 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Eldar Insafutdinov 2009-12-01 15:19:15 UTC
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 yebblies 2012-02-20 00:10:09 UTC
Works with current D2 (2.058).
This is a duplicate, I just don't know where the other bug report is.