Skip to content

Instantly share code, notes, and snippets.

@ldionne

ldionne/no_adl.cpp

Created Mar 5, 2015
Embed
What would you like to do?
Make sure Hana avoids undesirable instantiations because of ADL.
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