www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3563] New: Enum values returned by ref from a function trigger compiler error.

http://d.puremagic.com/issues/show_bug.cgi?id=3563

           Summary: Enum values returned by ref from a function trigger
                    compiler error.
           Product: D
           Version: 2.036
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: e.insafutdinov gmail.com


--- Comment #0 from Eldar Insafutdinov <e.insafutdinov gmail.com> 2009-12-01
15:19:15 PST ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 01 2009