Created
March 5, 2015 21:11
-
-
Save ldionne/b022f25ee87ebc2ff839 to your computer and use it in GitHub Desktop.
Make sure Hana avoids undesirable instantiations because of ADL.
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
template <typename ...T> | |
struct _tuple_t { | |
struct _; | |
}; | |
template <typename ...T> | |
struct _tuple_t<T...>::_ | |
: _tuple_t<T...> | |
{ }; | |
template <typename ...T> | |
using tuple_t = typename _tuple_t<T...>::_; | |
template <bool b = false> | |
struct invalid { static_assert(b, "invalid must not be instantiated"); }; | |
template <typename T> void adl(T) { } | |
template <typename ...T> void adl_pattern(_tuple_t<T...>) { } | |
int main() { | |
adl(tuple_t<invalid<>>{}); | |
adl_pattern(tuple_t<invalid<>>{}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment