diff options
author | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-09 12:38:00 +0000 |
---|---|---|
committer | redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-11-09 12:38:00 +0000 |
commit | b06ebed55304d3344917a8b249cab1955a9e7d23 (patch) | |
tree | 02a44fb906ee33f23c3474e42a2d8281b25b50ed /libstdc++-v3/testsuite/25_algorithms | |
parent | 5f35dd0e122d3aa3cccd4a32c912c25f60064ee6 (diff) | |
download | ppe42-gcc-b06ebed55304d3344917a8b249cab1955a9e7d23.tar.gz ppe42-gcc-b06ebed55304d3344917a8b249cab1955a9e7d23.zip |
PR libstdc++/58982
* include/bits/stl_algobase.h (__copy_move::__copy_m): Use assertion
to prevent using memmove() on non-assignable types.
(__copy_move_backward::__copy_move_b): Likewise.
* include/bits/stl_uninitialized.h (uninitialized_copy
uninitialized_copy_n, uninitialized_fill, uninitialized_fill_n,
__uninitialized_default, __uninitialized_default_n): Check for
assignable as well as trivial.
* testsuite/20_util/specialized_algorithms/uninitialized_copy/
58982.cc: New.
* testsuite/20_util/specialized_algorithms/uninitialized_copy_n/
58982.cc: New.
* testsuite/20_util/specialized_algorithms/uninitialized_fill/
58982.cc: New.
* testsuite/20_util/specialized_algorithms/uninitialized_fill_n/
58982.cc: New.
* testsuite/25_algorithms/copy/58982.cc: New.
* testsuite/25_algorithms/copy_n/58982.cc: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@204615 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/testsuite/25_algorithms')
-rw-r--r-- | libstdc++-v3/testsuite/25_algorithms/copy/58982.cc | 42 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/25_algorithms/copy_n/58982.cc | 42 |
2 files changed, 84 insertions, 0 deletions
diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/58982.cc b/libstdc++-v3/testsuite/25_algorithms/copy/58982.cc new file mode 100644 index 00000000000..58ece1b80f6 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/58982.cc @@ -0,0 +1,42 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 25.3.1 copy + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <algorithm> + +// libstdc++/58982 + +// trivial class that is not assignable +struct T +{ + T() = default; + ~T() = default; + + T& operator=(const T&) = delete; +}; + +void +test01(T* result) +{ + T t[1]; + std::copy(t, t+1, result); // { dg-error "here" } +} +// { dg-prune-output "not assignable" } diff --git a/libstdc++-v3/testsuite/25_algorithms/copy_n/58982.cc b/libstdc++-v3/testsuite/25_algorithms/copy_n/58982.cc new file mode 100644 index 00000000000..f7dfa599388 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy_n/58982.cc @@ -0,0 +1,42 @@ +// Copyright (C) 2013 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// 25.3.1 copy + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <algorithm> + +// libstdc++/58982 + +// trivial class that is not assignable +struct T +{ + T() = default; + ~T() = default; + + T& operator=(const T&) = delete; +}; + +void +test01(T* result) +{ + T t[1]; + std::copy_n(t, 1, result); // { dg-error "here" } +} +// { dg-prune-output "not assignable" } |