diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-21 14:23:15 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-06-21 14:23:15 +0000 |
commit | 71d44a512abcfa6f8e82b8bd0c2026595ed9bc81 (patch) | |
tree | 627954bccc61124f7e77d0b00ca7e0ff1f8b6893 /libstdc++-v3/include | |
parent | 4aa48cf881b7d168f367e2a280789428970ccf06 (diff) | |
download | gcc-71d44a512abcfa6f8e82b8bd0c2026595ed9bc81.tar.gz |
2013-06-21 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/57666
* include/std/valarray (valarray<>::operator=(const _Expr<>&)):
Implement correctly C++11 26.6.2.3/1.
* testsuite/26_numerics/valarray/dr630-3.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@200305 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include')
-rw-r--r-- | libstdc++-v3/include/std/valarray | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray index 6bee6e0c02b..be96af6694e 100644 --- a/libstdc++-v3/include/std/valarray +++ b/libstdc++-v3/include/std/valarray @@ -819,8 +819,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline valarray<_Tp>& valarray<_Tp>::operator=(const _Expr<_Dom, _Tp>& __e) { - _GLIBCXX_DEBUG_ASSERT(_M_size == __e.size()); - std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 630. arrays of valarray. + if (_M_size == __e.size()) + std::__valarray_copy(__e, _M_size, _Array<_Tp>(_M_data)); + else + { + if (_M_data) + { + std::__valarray_destroy_elements(_M_data, _M_data + _M_size); + std::__valarray_release_memory(_M_data); + } + _M_size = __e.size(); + _M_data = __valarray_get_storage<_Tp>(_M_size); + std::__valarray_copy_construct(__e, _M_size, _Array<_Tp>(_M_data)); + } return *this; } |