[Bug c++/47172] New: [C++0x] cannot call member function without object

marc.glisse at normalesup dot org gcc-bugzilla@gcc.gnu.org
Tue Jan 4 21:42:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47172

           Summary: [C++0x] cannot call member function without object
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: marc.glisse@normalesup.org


The following code fails to compile with -std=c++0x, but compiles with c++98 or
if I change the prototype of f to make it return void. It doesn't look like PR
46731.

struct A
{
    int f() const;
};

template <class T>
struct B : A { };

template <class T>
struct C : B<T>
{
    void g();
};

template <class T>
void C<T>::g()
{
    A::f();
}

bug.cpp:18:11: error: cannot call member function 'int A::f() const' without
object



More information about the Gcc-bugs mailing list