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
19struct X {
20 X(int) {}
21
22 X(X&&) = default;
23 X& operator=(X&&) = default;
24
25private:
26 X(const X&) = default;
27 X& operator=(const X&) = default;
28};
29
30void PushFront(X&&) {}
31
32template<class T = int>
33auto test(int) -> decltype(PushFront(std::declval<T>()), std::true_type{});
34auto test(long) -> std::false_type;
35
36int 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

Provided by KDAB

Privacy Policy
Improve your Profiling and Debugging skills
Find out more

source code of libcxx/test/support/test.workarounds/c1xx_broken_za_ctor_check.pass.cpp