This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [RFA] handling of 'operator' in cp_find_first_component
On 23 Apr 2003 16:02:06 -0700, David Carlton <carlton at math dot stanford dot edu> said:
> On Mon, 21 Apr 2003 23:21:52 -0400, Daniel Jacobowitz <drow at mvista dot com> said:
>> That said, I still think your patch is OK; on the condition that it
>> handles the test case the comment you're removing refers to. Something
>> like:
>> int foo<operator() (B&)>
>> or whatever it was in the right syntax. Does it, and can you add that
>> to the maint.exp tests?
> It should handle them, but you're right, I should include such
> examples in the maint.exp tests. I'll go off and generate some
> examples first before checking it in.
I've checked it in with more examples, as you requested. I can get
the demangler to produce this:
jackfruit$ c++filt _Z3fooIXadL_Zls1CS0_EEEiv
int foo<&(operator<<(C, C))>()
Just to be on the safe side, I added variants of that without the
extra parens and even without the &, but with a comment that I'd only
seen the first one in the wild. I'm including the new maint.exp patch
below; I didn't change the cp-support.c patch.
David Carlton
carlton at math dot stanford dot edu
2003-04-23 David Carlton <carlton at bactrian dot org>
* gdb.c++/maint.exp (test_first_component): Add tests for
'operator' in more locations.
Index: maint.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.c++/maint.exp,v
retrieving revision 1.1
diff -u -p -r1.1 maint.exp
--- maint.exp 15 Apr 2003 23:07:11 -0000 1.1
+++ maint.exp 23 Apr 2003 23:43:31 -0000
@@ -63,6 +63,18 @@ proc test_first_component {} {
test_single_component "foo(std::basic_streambuf<wchar_t,std::char_traits<wchar_t> >)"
test_single_component "operator>(X::Y)"
+ # Operator names can show up in weird places.
+
+ test_single_component "int operator<< <char>()"
+ test_single_component "T<Cooperator>"
+
+ # NOTE: carlton/2003-04-23: I've only seen the first of these
+ # produced by the demangler, but I'm including two more just to be
+ # on the safe side.
+ test_single_component "int foo<&(operator<<(C, C))>()"
+ test_single_component "int foo<&operator<<(C, C)>()"
+ test_single_component "int foo<operator<<(C, C)>()"
+
gdb_test "maint cp first_component foo::bar" "foo"
gdb_test "maint cp first_component foo::bar::baz" "foo"
gdb_test "maint cp first_component C<A>::bar" "C<A>"