xref: /llvm-project/libcxx/test/std/numerics/rand/rand.util/rand.util.seedseq/iterator.verify.cpp (revision 8b29b84c99ac8140c9820fd34b733bdedf5bb0f5)
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 // <random>
10 
11 // class seed_seq;
12 
13 // template<class InputIterator>
14 //   seed_seq(InputIterator begin, InputIterator end);
15 // Mandates: iterator_traits<InputIterator>::value_type is an integer type.
16 
17 #include <random>
18 
test()19 void test()
20 {
21   {
22     bool a[2] = {true, false};
23     std::seed_seq s(a, a+2); // OK
24   }
25   {
26     double a[2] = {1, 2};
27     std::seed_seq s(a, a+2); // expected-error@*:* {{Mandates: iterator_traits<InputIterator>::value_type is an integer type}}
28         // expected-error@*:* {{invalid operands to binary expression ('double' and 'unsigned int')}}
29   }
30 }
31