[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / utilities / template.bitset / bitset.members / set_one.out_of_range.pass.cpp
blob2d93e3e5e9f4b68dd755a51a416bff3fafe0b3cf
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: no-exceptions
11 // test bitset<N>& set(size_t pos, bool val = true);
13 // Make sure we throw std::out_of_range when calling set() on an OOB index.
15 #include <bitset>
16 #include <cassert>
17 #include <stdexcept>
19 int main(int, char**) {
21 std::bitset<0> v;
22 try { v.set(0); assert(false); } catch (std::out_of_range const&) { }
25 std::bitset<1> v("0");
26 try { v.set(2); assert(false); } catch (std::out_of_range const&) { }
29 std::bitset<10> v("0000000000");
30 try { v.set(10); assert(false); } catch (std::out_of_range const&) { }
33 return 0;