This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB 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++/15008] New: Lookup of base types with virtual functions isbroken


http://sourceware.org/bugzilla/show_bug.cgi?id=15008

             Bug #: 15008
           Summary: Lookup of base types with virtual functions is broken
           Product: gdb
           Version: 7.5
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned@sourceware.org
        ReportedBy: andre.poenitz@digia.com
    Classification: Unclassified


In the following code I would expect 'ptype A' to find A, no matter whether foo
is declared virtual or not"


    struct A { };
    struct B : A { };
    struct C : B { virtual void foo() { } };

    struct D : C
    {
        void foo()
        {
            // Break here.
            // (gdb) ptype A
            // -> Type D has no component named A.
            A *b = 0;
        }

        void bar()
        {
            // Break here.
            // (gdb) ptype A
            // -> Type D has no component named A.
            A *b = 0;
        }
    };

    int main()
    {
        // Break here.
        // (gdb) ptype A
        // -> type = struct A { ... }
        D d;
        d.foo();
        d.bar();
    }


    // Note: If the 'virtual' is removed from C::foo(),
    // ptype A works in both D::foo() and D::bar()

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


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