This ensures that the std::seed_seq initializer-list constructor will
not be used for list-initialization unless the initializers in the list
are integers. This allows list-initialization syntax to be used with a
pair of pointers and for that to use the appropriate constructor.
Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:
* include/bits/random.h (seed_seq): Constrain initializer-list
constructor.
* include/bits/random.tcc (seed_seq): Add template parameter.
* testsuite/26_numerics/random/seed_seq/cons/default.cc: Check
for noexcept.
* testsuite/26_numerics/random/seed_seq/cons/initlist.cc: Check
constraints.
: _M_v()
{ }
- template<typename _IntType>
+ template<typename _IntType, typename = _Require<is_integral<_IntType>>>
seed_seq(std::initializer_list<_IntType> __il);
template<typename _InputIterator>
}
- template<typename _IntType>
+ template<typename _IntType, typename>
seed_seq::seed_seq(std::initializer_list<_IntType> __il)
{
for (auto __iter = __il.begin(); __iter != __il.end(); ++__iter)
#include <random>
#include <testsuite_hooks.h>
+static_assert( std::is_nothrow_default_constructible<std::seed_seq>::value,
+ "LWG 3422" );
+
void
test01()
{
seq.generate(foo.begin(), foo.end());
VERIFY( seq.size() == 0 );
- //VERIFY();
}
int
VERIFY( seq.size() == 10 );
}
+void
+lwg3422()
+{
+ int i[32] = { };
+ std::seed_seq ss{i, i+32}; // LWG 3422
+}
+
int main()
{
test01();