Skip to content

Instantly share code, notes, and snippets.

@Cryolite
Created August 4, 2012 15:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Cryolite/3258235 to your computer and use it in GitHub Desktop.
Save Cryolite/3258235 to your computer and use it in GitHub Desktop.
struct B
{};
struct D
: private B
{};
template<typename T>
T &&declval();
template<typename T, typename = decltype(false ? declval<B *>() : declval<T *>())>
constexpr bool test(int)
{
return true;
}
template<typename T>
constexpr bool test(void *)
{
return false;
}
int main()
{
static_assert(test<B>(0), "");
static_assert(!test<D>(0), "");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment