1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
11 // constexpr bool test(size_t pos) const;
13 // Make sure we throw std::out_of_range when calling test() on an OOB index.
19 int main(int, char**) {
22 try { (void) v
.test(0); assert(false); }
23 catch (std::out_of_range
const&) { }
26 std::bitset
<1> v("0");
27 try { (void) v
.test(2); assert(false); }
28 catch (std::out_of_range
const&) { }
31 std::bitset
<10> v("0000000000");
32 try { (void) v
.test(10); assert(false); }
33 catch (std::out_of_range
const&) { }