Skip to content

Instantly share code, notes, and snippets.

@telishev
Created September 5, 2016 13:52
Show Gist options
  • Save telishev/4b97691623d91e52009922044ba11034 to your computer and use it in GitHub Desktop.
Save telishev/4b97691623d91e52009922044ba11034 to your computer and use it in GitHub Desktop.
#include <iostream>
template <int x> struct C {};
template<>
struct C<0> { using type = void; };
struct D : C<1>, C<0> {};
template <typename A = C<0>, typename = typename A::type>
void f (const C<0> &y) { std::cout << 0 << "\n"; }
template <typename A = C<1>, typename = typename A::type, typename = void>
void f (const C<1> &y) { std::cout << 1 << "\n"; }
int main ()
{
f (D ());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment