Last active
October 31, 2020 21:11
-
-
Save BillyDonahue/c3aaf3095e8c502323ca9c4220f192fd to your computer and use it in GitHub Desktop.
msvc bug: expr sfinae on private
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
#include <type_traits> | |
template <typename T, typename=void> struct Direct : std::false_type {}; | |
template <typename T> struct Direct<T, std::void_t<decltype(std::declval<T>().f())>> : std::true_type {}; | |
template <typename T> using Op = decltype(std::declval<T>().f()); | |
template <typename T, typename=void> struct ViaAlias : std::false_type {}; | |
template <typename T> struct ViaAlias<T, std::void_t<Op<T>>> : std::true_type {}; | |
class X { void f(); }; | |
static_assert(!Direct<X>::value,"Direct<X>"); // PASSES | |
static_assert(!ViaAlias<X>::value,"ViaAlias<X>"); // FAILS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment