[Issue 6336] New: Can't return ref T where T has const/immutable members

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 16 08:25:11 PDT 2011


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

           Summary: Can't return ref T where T has const/immutable members
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis <verylonglogin.reg at gmail.com> 2011-07-16 08:19:56 PDT ---
As a result "front" and "back" template functions from std.array don't compile,
isInputRange!(S[]) is false and none of range functions can work with an array
of structs with a const/immutable member.


immutable struct IS { int t; }
struct S { immutable int t; }

void f(ref S) { } //compiles
ref IS f() { return IS(); } //compiles too
ref S f() { return S(); } //doesn't compile

void main() {
    static assert( isInputRange!(S[]) ); //as a result assertion failure
}

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


More information about the Digitalmars-d-bugs mailing list