Issue 5193 - SList cannot have struct elements that have immutable members.

This commit is contained in:
k-hara 2011-10-28 23:20:23 +09:00
parent beaf8114b0
commit fd3184f88a

View file

@ -947,10 +947,13 @@ Defines the container's primary range, which embodies a forward range.
/// ditto
@property T front() { return _head._payload; }
/// ditto
@property void front(T value)
static if (isAssignable!(T, T))
{
enforce(_head);
_head._payload = value;
@property void front(T value)
{
enforce(_head);
_head._payload = value;
}
}
/// ditto
void popFront()
@ -1025,10 +1028,13 @@ Forward to $(D opSlice().front(value)).
Complexity: $(BIGOH 1)
*/
@property void front(T value)
static if (isAssignable!(T, T))
{
enforce(_root);
_root._payload = value;
@property void front(T value)
{
enforce(_root);
_root._payload = value;
}
}
unittest
@ -1441,6 +1447,16 @@ unittest
auto s = make!(SList!int)(1, 2, 3);
}
unittest
{
// 5193
static struct Data
{
const int val;
}
SList!Data list;
}
/**
Array type with deterministic control of memory. The memory allocated
for the array is reclaimed as soon as possible; there is no reliance