Debian Codegraph @

libcxx/test/libcxx-03/containers/associative/map/at.abort.pass.cpp

raw
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 // <map>
10
11 // class map
12
13 // mapped_type& at(const key_type& k);
14
15 // Make sure we abort() when exceptions are disabled and we fetch a key that
16 // is not in the map.
17
18 // REQUIRES: no-exceptions
19
20 #include <csignal>
21 #include <cstdlib>
22 #include <map>
23
24 #include "test_macros.h"
25
26 void exit_success(int) { std::_Exit(EXIT_SUCCESS); }
27
28 int main(int, char**) {
29 std::signal(SIGABRT, exit_success);
30 std::map<int, int> map;
31 map.at(1);
32 return EXIT_FAILURE;
33 }