1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <vector> template<typename A> struct AClass {}; #define specialize_AClass(X)\ template<> struct AClass<X> { X a; }; specialize_AClass(int) //ok specialize_AClass(std::vector<int,std::allocator<int> >) //error int main() { return 0; }
1 2 3
Line 55: error: macro "specialize_AClass" passed 2 arguments, but takes just 1 Line 15: error: expected constructor, destructor, or type conversion before 'int' compilation terminated due to -Wfatal-errors.