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 // UNSUPPORTED: c++03
10 // ADDITIONAL_COMPILE_FLAGS: -Wno-sign-compare -Wno-shift-count-negative
11 
12 // <random>
13 
14 #include <random>
15 
16 template<class Int>
17 struct G {
18   using result_type = Int;
19   result_type operator()();
minG20   static constexpr result_type min() { return 0; }
maxG21   static constexpr result_type max() { return 255; }
22 };
23 
test(std::geometric_distribution<int> dist)24 void test(std::geometric_distribution<int> dist)
25 {
26   G<int> badg;
27   G<unsigned> okg;
28 
29   dist(badg); //expected-error@*:* 7 {{static assertion failed}} //expected-note {{in instantiation}}
30   dist(okg);
31 }
32