[Bug c++/65188] New: diagnostic: missing: reference to non-static member function must be called
jan.kratochvil at redhat dot com
gcc-bugzilla@gcc.gnu.org
Tue Feb 24 11:11:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65188
Bug ID: 65188
Summary: diagnostic: missing: reference to non-static member
function must be called
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.kratochvil at redhat dot com
Target: x86_64-linux-gnu
class C { public: void f() {} } c;
int main() { return c.f.a; }
-Wall
g++ (GCC) 5.0.0 20150224 (experimental)
-------------------------------------------------------------------------------
10.C: In function ‘int main()’:
10.C:2: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:2: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; }
~~^
()
10.C:2:24: error: member reference base type 'void' is not a structure or union
int main() { return c.f.a; }
~~~^~
2 errors generated.
-------------------------------------------------------------------------------
I had no idea what GCC errors on until I asked clang. It may be obvious here
but with complicated classes the better error message is really helpful.
More information about the Gcc-bugs
mailing list