In debug mode, VS 2010,
#include <iostream>
using namespace std;
template<typename T,void (T::*m)(int)>
struct B{
void f(T* a,int x){
(a->*m)(x);
}
};
struct A{
virtual void v(int){}
B<A,&v> b;
};
int main(){
A a;
}
This code crashes. Remove the virtual, it will compile
No comments:
Post a Comment