This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/46731] New: GCC shouts "cannot call member function 'void a::g()' without object" if a is a dependent base class
- From: "schaub-johannes at web dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 30 Nov 2010 19:09:45 +0000
- Subject: [Bug c++/46731] New: GCC shouts "cannot call member function 'void a::g()' without object" if a is a dependent base class
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46731
Summary: GCC shouts "cannot call member function 'void a::g()'
without object" if a is a dependent base class
Product: gcc
Version: 4.5.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: schaub-johannes@web.de
This code should compile just fine, but it fails with GCC
struct a {
void g() { }
template<typename T>
struct b : T { void f() { g(); } };
};
void f() {
a::b<a> x;
x.f();
}
[js@HOST2 cpp]$ LC_ALL=C g++ main1.cpp
main1.cpp: In member function 'void a::b<T>::f() [with T = a]':
main1.cpp:9:7: instantiated from here
main1.cpp:4:29: error: cannot call member function 'void a::g()' without object
The reason for its validity has been discussed at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21008 and
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#515 .