diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2015-04-28 13:35:30 +0100 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2015-04-28 13:35:30 +0100 |
commit | d747ee05e36de80e530ad7d361750bba5c890342 (patch) | |
tree | 70c6d512e1823606fc3780bd0050a10b99b392fc | |
parent | 196e0493cbb815694372c520cfb9150cad60d799 (diff) | |
download | gcc-d747ee05e36de80e530ad7d361750bba5c890342.zip gcc-d747ee05e36de80e530ad7d361750bba5c890342.tar.gz gcc-d747ee05e36de80e530ad7d361750bba5c890342.tar.bz2 |
re PR libstdc++/65631 (seed_seq should not be copyable)
PR libstdc++/65631
* include/bits/random.h (seed_seq) Define copy constructor and copy
assignment as deleted.
* testsuite/26_numerics/random/seed_seq/cons/65631.cc: New.
From-SVN: r222524
-rw-r--r-- | libstdc++-v3/ChangeLog | 5 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/random.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/65631.cc | 28 |
3 files changed, 37 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 159362d..c0f2924 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,10 @@ 2015-04-28 Jonathan Wakely <jwakely@redhat.com> + PR libstdc++/65631 + * include/bits/random.h (seed_seq) Define copy constructor and copy + assignment as deleted. + * testsuite/26_numerics/random/seed_seq/cons/65631.cc: New. + * libsupc++/exception (uncaught_exceptions): Add comment. Reorder #if. * testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: Use -std=gnu++1z. Check feature-test macro. diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index 8caade5..501243d 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -6053,6 +6053,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION param(OutputIterator __dest) const { std::copy(_M_v.begin(), _M_v.end(), __dest); } + // no copy functions + seed_seq(const seed_seq&) = delete; + seed_seq& operator=(const seed_seq&) = delete; + private: /// std::vector<result_type> _M_v; diff --git a/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/65631.cc b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/65631.cc new file mode 100644 index 0000000..cdc4e57 --- /dev/null +++ b/libstdc++-v3/testsuite/26_numerics/random/seed_seq/cons/65631.cc @@ -0,0 +1,28 @@ +// Copyright (C) 2015 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/>. + +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +#include <random> +#include <type_traits> + +static_assert( !std::is_copy_constructible<std::seed_seq>::value, + "seed_seq is not copy constructible" ); + +static_assert( !std::is_copy_assignable<std::seed_seq>::value, + "seed_seq is not copy assignable" ); |