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
11 // <utility>
12
13 // template <class T1, class T2> struct pair
14
15 // constexpr pair();
16
17 #include <utility>
18 #include <type_traits>
19
20 #include "test_macros.h"
21
22
23 struct ThrowingDefault {
ThrowingDefaultThrowingDefault24 ThrowingDefault() { }
25 };
26
27 struct NonThrowingDefault {
NonThrowingDefaultNonThrowingDefault28 NonThrowingDefault() noexcept { }
29 };
30
main(int,char **)31 int main(int, char**) {
32
33 static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, ThrowingDefault>>::value, "");
34 static_assert(!std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, ThrowingDefault>>::value, "");
35 static_assert(!std::is_nothrow_default_constructible<std::pair<ThrowingDefault, NonThrowingDefault>>::value, "");
36 static_assert( std::is_nothrow_default_constructible<std::pair<NonThrowingDefault, NonThrowingDefault>>::value, "");
37
38 return 0;
39 }
40