Isolated test case (fails to compile on the assert statement):
#include <cassert>
template <typename A> struct Base { template <typename T, typename V> void foo(T* target, void (V::*method)()) { assert(dynamic_cast<T*>(target)); } };
struct C { void foo() {} };
int main() { C c; Base<int>().foo(&c, &C::foo); return 0; }
Isolated test case (fails to compile on the assert statement):
#include <cassert>
template <typename A>
assert( dynamic_ cast<T* >(target) );
struct Base {
template <typename T, typename V>
void foo(T* target, void (V::*method)())
{
}
};
struct C { void foo() {} };
int main() int>(). foo(&c, &C::foo);
{
C c;
Base<
return 0;
}