I was going through some of the old bugs and came across PR21069 which I was able to reproduce. The issue is that we match the regex ^foo against the DW_AT_name in the DWARF, which for our anonymous function is indeed foo. However, when we get the function name from the symbol context, the result is (anonymous namespace)::foo(). This throws off completions, which assumes that it's appending to whatever is already present on the input, resulting in a bogus b fooonymous\ namespace)::foo().
I'm not super familiar with the completion framework, so please let me know if there's a better way to solve this issue.