This is the mail archive of the gdb-patches@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]

Re: [RFC] delete gdb.cp/ambiguous.exp ?


On 08/19/2014 12:23 AM, Doug Evans wrote:
> Along the lines of dead code removal ...
> 
> What should we do with this testcase?
> 
> The messages it is looking for from gdb do not exist,

Hmm.  These are:

# X is derived from A1 and A2; both A1 and A2 have a member 'x'
send_gdb "print x.x\n"
gdb_expect {
   -re "warning: x ambiguous; using X::A2::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
       pass "print x.x"
   }
   -re "warning: x ambiguous; using X::A1::x. Use a cast to disambiguate.\r\n\\$\[0-9\]* = \[-\]*\[0-9\]*\r\n$gdb_prompt $" {
       pass "print x.x"
   }
   -re ".*$gdb_prompt $" { fail "print x.x" }
   timeout { fail "(timeout) print x.x" }
}

Actually enabling the test (removing the skip, and adding
nowarnings), we see that indeed GDB outputs no warning:

 print x.x
 $1 = 994109222
 (gdb) FAIL: gdb.cp/ambiguous.exp: print x.x

but, GDB also silently picks an 'x'.  If we try compiling 'x.x', we get:

 ambiguous.cc: In function ‘int main()’:
 ambiguous.cc:103:67: error: request for member ‘x’ is ambiguous
    i += k.i + m.w + a1.x + a2.x + a3.x + x.z + l.z + n.r + j.j + x.x;
                                                                    ^
 ambiguous.cc:15:7: note: candidates are: int A2::x
    int x;
        ^
 ambiguous.cc:9:7: note:                 int A1::x

And gdb.cp/inherit.exp has:

    # Print all members of g_D.
    #
    # g_D.A::a and g_D.A::x are ambiguous member accesses.
    gdb_test "print g_D.A::a" "base class 'A' is ambiguous in type 'D'"

So shouldn't GDB error out in the 'x.x' case too ?  Or at
least warn, like the test suggests (I bet this came in with
the big HP merge years ago).

In this case below, GDB does error out, though the test
expects a warning:

 print (A1)j
 base class 'A1' is ambiguous in type 'J'
 (gdb) FAIL: gdb.cp/ambiguous.exp: print (A1)j

Running /home/pedro/gdb/mygit/src/gdb/testsuite/gdb.cp/ambiguous.exp ...
FAIL: gdb.cp/ambiguous.exp: print x.x
FAIL: gdb.cp/ambiguous.exp: print n.x
FAIL: gdb.cp/ambiguous.exp: print j.x
FAIL: gdb.cp/ambiguous.exp: print jva1.x
FAIL: gdb.cp/ambiguous.exp: print jva2.x
FAIL: gdb.cp/ambiguous.exp: print (A1)j
FAIL: gdb.cp/ambiguous.exp: print (A1)jva1

-- 
Thanks,
Pedro Alves


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