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// explicit(see-below) constexpr pair();
16
17// This test checks the conditional explicitness of std::pair's default
18// constructor as introduced by the resolution of https://wg21.link/LWG2510.
19
20#include <utility>
21
22
23struct ImplicitlyDefaultConstructible {
24 ImplicitlyDefaultConstructible() = default;
25};
26
27struct ExplicitlyDefaultConstructible {
28 explicit ExplicitlyDefaultConstructible() = default;
29};
30
31std::pair<ImplicitlyDefaultConstructible, ExplicitlyDefaultConstructible> test1() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
32std::pair<ExplicitlyDefaultConstructible, ImplicitlyDefaultConstructible> test2() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
33std::pair<ExplicitlyDefaultConstructible, ExplicitlyDefaultConstructible> test3() { return {}; } // expected-error 1 {{chosen constructor is explicit in copy-initialization}}
34std::pair<ImplicitlyDefaultConstructible, ImplicitlyDefaultConstructible> test4() { return {}; }
35

source code of libcxx/test/std/utilities/utility/pairs/pairs.pair/ctor.default.explicit_LWG2510.verify.cpp