http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54336
--- Comment #2 from Andy Lutomirski <luto at mit dot edu> 2012-08-20 23:21:32 UTC --- Fair enough. Here's a better example: struct A { int method(); }; template<typename T> auto func(T x) -> decltype(x.method()) { bogus(x); } int main() { func(A()); } The error is: decltype_return.cc: In instantiation of 'decltype (x.method()) func(T) [with T = A; decltype (x.method()) = int]': decltype_return.cc:8:22: required from here decltype_return.cc:5:3: error: 'bogus' was not declared in this scope bogus(x); ^ 'decltype (x.method())' is still meaningless in that context. Even just 'auto func(T) [with ...; auto = int]' might be less puzzling. (This is a very minor issue -- I just found it puzzling when I hit it earlier today in an STL error message.)