
Hello all, The following code compiles on GCC (v3.4.3) but it does not on MSVC (cl.exe v14): #include <boost/type_traits.hpp> template<typename T> void f(T& x) { struct s { T g() { // GCC needs this typename but MSVC does not -- why?? typename boost::remove_reference<T&>::type i = 0; return i; } }; x = s().g(); } int main() { int x; f(x); return 0; } MSVC does not accept the `typename` inside `s::g` because it says it's not within a template (but I think it is within a template...). GCC instead requires that `typename`. Which compiler is right? (What does the standard say?) How do I program this code so it works on all compilers? Thank you very much. -- Lorenzo