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};
|
||||
int a2[] = {-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12};
|
||||
std::valarray<int> v1(a1, sizeof(a1)/sizeof(a1[0]));
|
||||
@@ -40,4 +41,16 @@ int main()
|
||||
assert(v1[13] == -11);
|
||||
assert(v1[14] == 14);
|
||||
assert(v1[15] == 15);
|
||||
}
|
||||
// Test return value of assignment.
|
||||
{
|
||||
int a1[] = {0, 1, 2};
|
||||
int a2[] = {3, 4, 3};
|
||||
std::valarray<int> v1(a1, 3);
|
||||
const std::valarray<int> v2(a2, 3);
|
||||
std::slice_array<int> s1 = v1[std::slice(1, 2, 3)];
|
||||
std::slice_array<int> s2 = v1[std::slice(2, 2, 3)];
|
||||
std::slice_array<int> const & s3 = (s1 = s2);
|
||||
assert(&s1 == &s3);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user