summaryrefslogtreecommitdiff
path: root/test/support/test.workarounds/c1xx_broken_za_ctor_check.pass.cpp
blob: 856574dbcf232efef2b9e45cd87ac5bd43bded49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: c++98, c++03

// Verify TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK.

#include <type_traits>

#include "test_workarounds.h"

struct X {
    X(int) {}

    X(X&&) = default;
    X& operator=(X&&) = default;

private:
    X(const X&) = default;
    X& operator=(const X&) = default;
};

void PushFront(X&&) {}

template<class T = int>
auto test(int) -> decltype(PushFront(std::declval<T>()), std::true_type{});
auto test(long) -> std::false_type;

int main() {
#if defined(TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK)
    static_assert(!decltype(test(0))::value, "");
#else
    static_assert(decltype(test(0))::value, "");
#endif
}