Add return statement to slice_array and mask_array assignment. Closes PR20614.
This patch just adds the required return statements to slice_array::operator= and mask_array::operator=. Tests were added to check that the return value is the same as the object assigned to. git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@215414 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -18,6 +18,7 @@
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
int a1[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
|
||||
const std::size_t N1 = sizeof(a1)/sizeof(a1[0]);
|
||||
bool b1[N1] = {true, false, false, true, true, false,
|
||||
@@ -48,4 +49,18 @@ int main()
|
||||
assert(v1[13] == 13);
|
||||
assert(v1[14] == 14);
|
||||
assert(v1[15] == 15);
|
||||
}
|
||||
// Test return value of assignment
|
||||
{
|
||||
int a1[] = {0, 1, 2};
|
||||
int a2[] = {3, 4, 5};
|
||||
bool b1[] = {true, false, true};
|
||||
std::valarray<int> v1(a1, 3);
|
||||
std::valarray<int> v2(a2, 3);
|
||||
std::valarray<bool> const vb1(b1, 3);
|
||||
std::mask_array<int> m1 = v1[vb1];
|
||||
std::mask_array<int> const m2 = v2[vb1];
|
||||
std::mask_array<int> const & r = (m1 = m2);
|
||||
assert(&r == &m1);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user