Debian Codegraph @

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