Bug 6336 – Can't return ref T where T has const/immutable members

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-07-16T08:19:00Z
Last change time
2012-10-07T11:49:15Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2011-07-16T08:19:56Z
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 }
Comment #1 by k.hara.pg — 2012-01-24T05:23:22Z
*** Issue 5690 has been marked as a duplicate of this issue. ***
Comment #2 by k.hara.pg — 2012-01-24T05:30:54Z
My pull request contains a fix for this issue. https://github.com/D-Programming-Language/dmd/pull/166
Comment #3 by k.hara.pg — 2012-04-11T06:33:19Z
*** Issue 7889 has been marked as a duplicate of this issue. ***
Comment #4 by issues.dlang — 2012-06-25T17:53:27Z
*** Issue 8297 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2012-10-07T09:15:00Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/b10781e6abe9472a6f327601daa870b180660128 fix Issue 6336 - Can't return ref T where T has const/immutable members Remove fail7695.d, because it was incorrectly failed to compile by bug 6336.
Comment #6 by yebblies — 2012-10-07T11:49:15Z