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, c++11, c++14, c++17 |
10 | // UNSUPPORTED: no-exceptions |
11 | |
12 | // <atomic> |
13 | |
14 | #include <atomic> |
15 | #include <cassert> |
16 | |
17 | struct throwing { |
18 | throwing() { throw 42; } |
19 | }; |
20 | |
21 | int main(int, char**) { |
22 | try { |
23 | [[maybe_unused]] std::atomic<throwing> a; |
24 | assert(false); |
25 | } catch (int x) { |
26 | assert(x == 42); |
27 | } |
28 | |
29 | return 0; |
30 | } |
31 | |