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 | // Verify TEST_WORKAROUND_MSVC_BROKEN_ZA_CTOR_CHECK. |
12 | |
13 | #include <type_traits> |
14 | #include <utility> |
15 | |
16 | #include "test_macros.h" |
17 | #include "test_workarounds.h" |
18 | |
19 | struct X { |
20 | X(int) {} |
21 | |
22 | X(X&&) = default; |
23 | X& operator=(X&&) = default; |
24 | |
25 | private: |
26 | X(const X&) = default; |
27 | X& operator=(const X&) = default; |
28 | }; |
29 | |
30 | void PushFront(X&&) {} |
31 | |
32 | template<class T = int> |
33 | auto test(int) -> decltype(PushFront(std::declval<T>()), std::true_type{}); |
34 | auto test(long) -> std::false_type; |
35 | |
36 | int main(int, char**) { |
37 | #ifdef TEST_WORKAROUND_MSVC_BROKEN_ZA_CTOR_CHECK |
38 | static_assert(!decltype(test(0))::value, ""); |
39 | #else |
40 | static_assert(decltype(test(0))::value, ""); |
41 | #endif |
42 | |
43 | return 0; |
44 | } |
45 |