[Bug c++/47985] New: suppose pure abstract function resolve error

gvolozhanin at mail dot ru gcc-bugzilla@gcc.gnu.org
Fri Mar 4 08:41:00 GMT 2011


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

           Summary: suppose pure abstract function resolve error
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gvolozhanin@mail.ru


class A {
public:
virtual ~A() {}
virtual void foo()=0;
};

class B {
public:
virtual ~B() {}
virtual void foo() { }
};

class C: public B, public A {
};

int main() {
  C c;
  c.foo();
  return 0;
}

$ g++ o.cpp
o.cpp: In function ‘int main()’:
o.cpp:17: error: cannot declare variable ‘c’ to be of abstract type ‘C’
o.cpp:13: note:   because the following virtual functions are pure within ‘C’:
o.cpp:4: note:     virtual void A::foo()
o.cpp:18: error: request for member ‘foo’ is ambiguous
o.cpp:4: error: candidates are: virtual void A::foo()
o.cpp:10: error:                 virtual void B::foo()

$ gcc --version
gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3

the bug maybe fixed already when recent visibility bugs fixed

anytime please don't waste time for the answer, best regards



More information about the Gcc-bugs mailing list