g++ doesn't like template method chaining on template var?
问题 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 method on a reference returned by a method of a template variable. I was able to narrow the problem down to the following code: class Inner { public: template<typename T> T get() const { return static_cast<T>(value_); }; private: int value_; }; class Outer { public: Inner const& get_inner() { return inner_; }; private: Inner inner_; };