]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Allow function types as template parameters in name canonicalizer
authorTom Tromey <tom@tromey.com>
Sat, 20 Apr 2024 16:44:13 +0000 (10:44 -0600)
committerTom Tromey <tom@tromey.com>
Tue, 14 May 2024 19:28:40 +0000 (13:28 -0600)
This adds function types as template parameters in the C++ name
canonicalizer.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=11907
Approved-By: John Baldwin <jhb@FreeBSD.org>
gdb/cp-name-parser.y
gdb/cp-support.c

index c0138efc64df7cb8cb6a75bdef22736bb9fa33c0..cf3e8bfd16f0604f401e7263de83d5028299516f 100644 (file)
@@ -596,6 +596,7 @@ template_arg        :       typespec_2
                |       '&' '(' start ')'
                        { $$ = state->fill_comp (DEMANGLE_COMPONENT_UNARY, state->make_operator ("&", 1), $3); }
                |       exp
+               |       function
                ;
 
 function_args  :       typespec_2
@@ -2062,6 +2063,9 @@ canonicalize_tests ()
   should_be_the_same ("x::y::z<0b111>", "x::y::z<0D7>");
 
   should_be_the_same ("x::y::z<0xff'ff>", "x::y::z<65535>");
+
+  should_be_the_same ("something<void ()>", "something<  void()  >");
+  should_be_the_same ("something<void ()>", "something<void (void)>");
 }
 
 #endif
index 536dbc400605f112c225cbce9570f32cb3ce09d3..bd714ad32ce949a5ca76b0cbbd7990052a200940 100644 (file)
@@ -2186,15 +2186,8 @@ test_cp_remove_params ()
   CHECK_INCOMPL ("A::foo<(anonymous namespace)::B",
                 "A::foo");
 
-  /* Shouldn't this parse?  Looks like a bug in
-     cp_demangled_name_to_comp.  See PR c++/22411.  */
-#if 0
   CHECK ("A::foo<void(int)>::func(int)",
         "A::foo<void(int)>::func");
-#else
-  CHECK_INCOMPL ("A::foo<void(int)>::func(int)",
-                "A::foo");
-#endif
 
   CHECK_INCOMPL ("A::foo<void(int",
                 "A::foo");