I noticed that gdb/cp-name-parser.y:cp_demangled_name_to_comp fails to grok this: "A::foo<void (int)>::func(int)" which is a valid symbol name that can result from something like this: ~~~ #include <stdio.h> namespace A { template<typename T> struct foo { void func (int) { printf ("hello"); } }; } A::foo<void(int)> f1; // bad cases instantiated from this one here A::foo<int> f2; int main (int argc, char **argv) { f1.func (argc); f2.func (argc); return 0; } ~~~ $ nm a.out | c++filt | grep func 000000000040062a W A::foo<void (int)>::func(int) 000000000040064c W A::foo<int>::func(int) Running the symbol through test-cp-name-parser, we see: $ ./test-cp-name-parser 'A::foo<void (int)>::func(int)' syntax error, near `int)>::func(int)' While the non-function-type one works OK: $ ./test-cp-name-parser 'A::foo<int>::func(int)' A::foo<int>::func(int) A smaller reproducer: $ ./test-cp-name-parser 'foo<void(void)>' syntax error, near `void)>' Function pointer types work OK: $ ./test-cp-name-parser 'foo<void (*) (void)>'
Dup. *** This bug has been marked as a duplicate of bug 11907 ***