This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/46731] New: GCC shouts "cannot call member function 'void a::g()' without object" if a is a dependent base class


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 .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]