GDB and LLDB don't mind if we omit the explicit import of an anonymous namespace.
I suppose... having the big hairy test inline isn't *that* unreadable.
Because the default (i.e., no tuning specified) behavior should be to conform to the DWARF spec, which basically says you need the explicit import. There's a new extra RUN line in the test, with no tuning specified, to verify this.
Basically, a namespace is a "context" for declarations, and the DWARF mechanism for making declarations from one context available in another context is with DW_TAG_imported_declaration and DW_TAG_imported_module.
The meaning of DWARF is determined by the DWARF spec, not the C++ spec, and the DWARF spec does not say there's anything special about a namespace that has no name. There is a perfectly reasonable DWARF mechanism for getting the desired effect, so there's no reason for DWARF to make a special rule for an unnamed namespace. Therefore, an anonymous namespace should be explicitly imported into the containing namespace. The explicit import would be marked artificial of course.
Ping. FWIW in today's DWARF meeting, we agreed that the Appendix D example of an anonymous namespace should have an explicit import from the containing scope (see DWARF v4, Figure 57 on p.233; it was essentially unchanged in the v5 draft).
I saw. If you want that to be a required element of the spec then we need to change multiple wordings in the DWARF spec. I think the right place to bring that up is with the committee. The example is perfectly valid DWARF with the import, it's just unnecessary.