Skip to content

Instantly share code, notes, and snippets.

@yuxuanchen1997
Created July 9, 2024 01:20
Show Gist options
  • Save yuxuanchen1997/2bbfc1b9d78fe43ed8784a5db11eac98 to your computer and use it in GitHub Desktop.
Save yuxuanchen1997/2bbfc1b9d78fe43ed8784a5db11eac98 to your computer and use it in GitHub Desktop.
Illformed test case for clang crash
template <bool v>
struct __bool_constant {
static constexpr bool value = v;
};
__bool_constant<true>;
template <int>
struct conditional {};
template <typename B> struct __and_ : conditional<B::value> {
static constexpr bool value = true;
};
template <typename A>
using _Requires = __and_<A>::value;
template <typename _Tp, typename... _Args>
struct __is_constructible_impl : __bool_constant<__is_constructible(_Tp, _Args...)> {};
template <typename> struct Meta;
template <typename _Tp> struct optional {
template <typename _Up, _Requires<__is_constructible_impl<_Tp, _Up>> = true> optional(_Up);
namespace d {
struct MoveOnly {};
struct S : MoveOnly {};
struct TryBase {
TryBase(optional<S>);
};
class Try : TryBase, MoveOnly {
using TryBase::TryBase;
};
}
};
template <typename T, bool = false>
struct MPMCQueue : MPMCQueueBase<MPMCQueue<T>> {
namespace c {
template <template <typename, bool>
class Derived,
typename T>
struct MPMCQueueBase<Derived<T, false>> {
static_assert(__is_constructible_impl<T, T>::value);
};
MPMCQueue<d::Try> queue_;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment