| 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 |
#ifndef TEST_META_UNARY_COMP_COMMON_H |
| 10 |
#define TEST_META_UNARY_COMP_COMMON_H |
| 11 |
|
| 12 |
#include "test_macros.h" |
| 13 |
|
| 14 |
#if TEST_STD_VER >= 11 |
| 15 |
struct TrivialNotNoexcept { |
| 16 |
TrivialNotNoexcept() noexcept(false) = default; |
| 17 |
TrivialNotNoexcept(const TrivialNotNoexcept&) noexcept(false) = default; |
| 18 |
TrivialNotNoexcept(TrivialNotNoexcept&&) noexcept(false) = default; |
| 19 |
TrivialNotNoexcept& operator=(const TrivialNotNoexcept&) noexcept(false) = default; |
| 20 |
TrivialNotNoexcept& operator=(TrivialNotNoexcept&&) noexcept(false) = default; |
| 21 |
}; |
| 22 |
#endif |
| 23 |
|
| 24 |
class Empty {}; |
| 25 |
|
| 26 |
struct NotEmpty { |
| 27 |
virtual ~NotEmpty(); |
| 28 |
}; |
| 29 |
|
| 30 |
union Union {}; |
| 31 |
|
| 32 |
struct bit_zero { |
| 33 |
int : 0; |
| 34 |
}; |
| 35 |
|
| 36 |
struct A { |
| 37 |
A(); |
| 38 |
A(const A&); |
| 39 |
A& operator=(const A&); |
| 40 |
}; |
| 41 |
|
| 42 |
class Abstract { |
| 43 |
virtual ~Abstract() = 0; |
| 44 |
}; |
| 45 |
|
| 46 |
// Types for reference_{constructs/converts}_from_temporary |
| 47 |
|
| 48 |
#if TEST_STD_VER >= 23 |
| 49 |
|
| 50 |
class NonPODClass { |
| 51 |
public: |
| 52 |
NonPODClass(int); |
| 53 |
}; |
| 54 |
enum Enum { EV }; |
| 55 |
struct Base { |
| 56 |
Enum e; |
| 57 |
int i; |
| 58 |
float f; |
| 59 |
NonPODClass* p; |
| 60 |
}; |
| 61 |
// Not PODs |
| 62 |
struct Derived : Base {}; |
| 63 |
|
| 64 |
template <class T, class RefType = T&> |
| 65 |
class ConvertsToRef { |
| 66 |
public: |
| 67 |
operator RefType() const { return static_cast<RefType>(obj); } |
| 68 |
mutable T obj = 42; |
| 69 |
}; |
| 70 |
template <class T, class RefType = T&> |
| 71 |
class ConvertsToRefPrivate { |
| 72 |
operator RefType() const { return static_cast<RefType>(obj); } |
| 73 |
mutable T obj = 42; |
| 74 |
}; |
| 75 |
|
| 76 |
class ExplicitConversionRvalueRef { |
| 77 |
public: |
| 78 |
operator int(); |
| 79 |
explicit operator int&&(); |
| 80 |
}; |
| 81 |
|
| 82 |
class ExplicitConversionRef { |
| 83 |
public: |
| 84 |
operator int(); |
| 85 |
explicit operator int&(); |
| 86 |
}; |
| 87 |
|
| 88 |
#endif |
| 89 |
|
| 90 |
#endif // TEST_META_UNARY_COMP_COMMON_H |