template <typename U, typename V>
struct S1 {
static constexpr const bool value = false;
};
template <typename U, typename V>
inline constexpr bool global_inline_var = S1<U, V>::value;
template <typename T>
struct S2 {
template <typename U, typename V>
static inline constexpr bool var = global_inline_var<U, V>;
};
template <typename U, typename V>
inline constexpr bool constexpr_return_false() {
return false;
}
template <typename U, typename V>
void foo() {
static_assert(S1<U, V>::value);
}
template void foo<int, float>();
template <typename U, typename V>
void foo2() {
static_assert(global_inline_var<U, V>);
}
template void foo2<int, float>();
template <typename T, typename U, typename V>
void foo3() {
static_assert(T::template var<U, V>);
}
template void foo3<S2<long>, int, float>();
template <typename T>
void foo4() {
static_assert(S1<T[sizeof(T)], int[4]>::value, "");
};
template void foo4<float>();
template <typename U, typename V>
void foo5() {
static_assert(!!(global_inline_var<U, V>));
}
template void foo5<int, float>();
struct ExampleTypes {
explicit ExampleTypes(int);
using T = int;
using U = float;
};
template <class T>
struct X {
int i = 0;
int j = 0;
constexpr operator bool() const { return false; }
};
template <class T>
void foo6() {
static_assert(X<typename T::T>());
static_assert(X<typename T::T>{});
static_assert(X<typename T::T>{1, 2});
static_assert(X<typename T::T>({1, 2}));
static_assert(typename T::T{0});
static_assert(typename T::T(0));
static_assert(sizeof(X<typename T::T>) == 0);
static_assert((const X<typename T::T> *)nullptr);
static_assert(static_cast<const X<typename T::T> *>(nullptr));
static_assert((const X<typename T::T>[]){} == nullptr);
static_assert(sizeof(X<decltype(X<typename T::T>().X<typename T::T>::~X())>) == 0);
static_assert(constexpr_return_false<typename T::T, typename T::U>());
}
template void foo6<ExampleTypes>();