Skip to content

Instantly share code, notes, and snippets.

@ldionne
Created March 5, 2015 21:11
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 ldionne/b022f25ee87ebc2ff839 to your computer and use it in GitHub Desktop.
Save ldionne/b022f25ee87ebc2ff839 to your computer and use it in GitHub Desktop.
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