My attempt is:
template<typename Derived>
struct Base
{
void A()
{
((Derived *)this)->B<42>();
}
};
struct Derived : Base<Derived>
{
template<int> void B() { }
};
(http://coliru.stacked-crooked.com/a/cb24dd811b562466)
Which results in
main.cpp: In member function 'void Base<Derived>::A()':
main.cpp:6:34: error: expected primary-expression before ')' token
((Derived *)this)->B<42>();
^
main.cpp: In instantiation of 'void Base<Derived>::A() [with Derived = Derived]':
main.cpp:17:17: required from here
main.cpp:6:30: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<'
((Derived *)this)->B<42>();
~~~~~~~~~~~~~~~~~~~~^~~