I\'m trying to compile with g++ some code previously developed under Visual C++ 2008 Express Edition, and it looks like g++ won\'t let me call a template m
I can't claim to be one of the, oh 10 people on the planet who fully understand C++ templates, but what you're doing here looks fine to me. (It fails with GCC 4.4.1 with the same error, BTW).
Changing do_outer
to
const Inner& inner = val.get_inner();
return inner.get();
works with GCC and presumably will also work with Visual C++.
You might consider filing a bug with GCC; either they'll fix it, or it will be closed as INVALID and in the process someone will hopefully explain why what you're doing is not valid code.
A further update and AHA: It turns out it's not actually valid code, GCC just gives a horrible error message. Intel C++ outputs the (actually helpful!) error message:
template.cpp(24): error: type name is not allowed
return val.get_inner().get();
Which made me realize the problem. Changing do_inner to
return val.get_inner().template get();
the code is accepted by both ICC and GCC.