[Issue 9947] reduce of an array of structs with an immutable field
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 16 03:19:38 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9947
Ryuichi OHORI <r.97all at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |r.97all at gmail.com
--- Comment #1 from Ryuichi OHORI <r.97all at gmail.com> 2013-05-16 03:19:35 PDT ---
Using DMD32 v2.061 on Windows 32bit, below doesn't work too.
I think this is the same issue:
-----
import std.stdio;
import std.algorithm : sort;
struct S
{
immutable int x;
}
void main()
{
auto arr = [S(0), S(2), S(1)];
sort!((a, b) => a.x < b.x)(arr);
arr.writeln();
}
-----
algorithm.d(1814):Error: cannot modify struct lhs S with immutable members
algorithm.d(1815): Error: cannot modify struct rhs S with immutable members
algorithm.d(7972): Error: template instance std.algorithm.swap!(S) error
instantiating
algorithm.d(7908): instantiated from here: swapAt!(S[])
algorithm.d(7993): instantiated from here: getPivot!(__lambda3, S[])
algorithm.d(7712): instantiated from here: quickSortImpl!(__lambda3, S[])
main.d(12): instantiated from here: sort!(__lambda3,
cast(SwapStrategy)0, S[])
algorithm.d(7908): Error: template instance std.algorithm.swapAt!(S[]) error
instantiating
algorithm.d(7993): instantiated from here: getPivot!(__lambda3, S[])
algorithm.d(7712): instantiated from here: quickSortImpl!(__lambda3, S[])
main.d(12): instantiated from here: sort!(__lambda3,
cast(SwapStrategy)0, S[])
algorithm.d(7993): Error: template instance main.main.getPivot!(__lambda3, S[])
error instantiating
algorithm.d(7712): instantiated from here: quickSortImpl!(__lambda3, S[])
main.d(12): instantiated from here: sort!(__lambda3,
cast(SwapStrategy)0, S[])
algorithm.d(7946): Error: cannot modify struct r[j] S with immutable members
algorithm.d(7949): Error: cannot modify struct r[j] S with immutable members
algorithm.d(8028): Error: template instance
main.main.optimisticInsertionSort!(__lambda3, S[]) error instantiating
algorithm.d(7712): instantiated from here: quickSortImpl!(__lambda3, S[])
main.d(12): instantiated from here: sort!(__lambda3,
cast(SwapStrategy)0, S[])
algorithm.d(7712): Error: template instance main.main.quickSortImpl!(__lambda3,
S[]) error instantiating
main.d(12): instantiated from here: sort!(__lambda3,
cast(SwapStrategy)0, S[])
main.d(12): Error: template instance main.main.sort!(__lambda3,
cast(SwapStrategy)0, S[]) error instantiating
--
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