https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63452

            Bug ID: 63452
           Summary: Cross class calling (pure virtual)
           Product: gcc
           Version: 4.7.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mathieu.malaterre at gmail dot com

You'll find a small c++ project I gather to demonstrate how a class A `foo`
function can be called using class B `foo` function.

I believe gcc confuse the two separate implementations instead of producing a
warning about conflicting symbols.

Code is at:
https://github.com/malaterre/gcc-virtual

Main code is:

int main()
{
  B b;
  b.foo();
}

It produces as output:

$ ./virt
I'm PA Implementation

while implementation is:

https://raw.githubusercontent.com/malaterre/gcc-virtual/master/B.cxx

[...]
struct Impl : public PB
{
  void foo()
    {
    std::cout << "I'm PB Implementation" << std::endl;
    }
};
[...]

Thanks for consideration.

Reply via email to