Created
August 4, 2012 15:01
-
-
Save Cryolite/3258235 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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