Not sure why this code generates a "no matching function for call to ‘test(main(int, char**)::A)", although the code runs compiles on MSVC, I was wondering if this is not standard ?
In C++98 local classes cannot be used as template parameters.
Depending on the version of GCC you are using, you may be able to compile that if you compile using the
-std=c++0x or -std=c++11 option.