http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57712
Bug ID: 57712 Summary: GCC fails to to match out-of-line template member function definition with declaration Product: gcc Version: 4.8.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: st at quanttec dot com g++ 4.8.1 fails to compile the following C++11 code: struct Test { int method(int value) { return value; } template <typename T> auto test(T value) -> decltype(this->method(value)); }; template <typename T> auto Test::test(T value) -> decltype(this->method(value)) { return this->method(value); } int main() { Test t; return t.test(0); } > g++ --std=c++11 test.cpp test.cpp:9:6: error: prototype for ‘decltype (this->.Test::method(value)) Test::test(T)’ does not match any in class ‘Test’ auto Test::test(T value) -> decltype(this->method(value)) { ^ test.cpp:5:8: error: candidate is: template<class T> decltype (this->.Test::method(value)) Test::test(T) auto test(T value) -> decltype(this->method(value)); If the member function is defined inline, gcc compiles it fine.