https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65188
--- Comment #2 from Jan Kratochvil <jan.kratochvil at redhat dot com> --- (In reply to Manuel López-Ibáñez from comment #1) > How does Clang message help in this case? The suggested fix 'c.f().a' will > just give 'invalid use of void type' I have minimized the testcase maybe more than appropriate, it was in fact: class D { public: int a; } d; class C { public: D &f() { return d; } } c; int main() { return c.f.a; } g++ (GCC) 5.0.0 20150224 (experimental) ------------------------------------------------------------------------------- 10.C: In function ‘int main()’: 10.C:3:21: error: ‘c.C::f’ does not have class type int main() { return c.f.a; } ^ ------------------------------------------------------------------------------- clang-3.5.0-6.fc21.x86_64 ------------------------------------------------------------------------------- 10.C:3:23: error: reference to non-static member function must be called; did you mean to call it with no arguments? int main() { return c.f.a; } ~~^ () 1 error generated. ------------------------------------------------------------------------------- > 4) For types that have declarations, we could point to the declaration with > a note: 'c.C::f' declared here Yes, that would be very useful.