https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68257
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
On non-namespace there is a clear requirement that it has at least one
argument.
For namespace, the code has for the case of zero arguments to the attribute
in gcc/cp/name-lookup.c (handle_namespace_attrs):
if (!args)
{
tree dn = DECL_NAME (ns);
args = build_string (IDENTIFIER_LENGTH (dn) + 1,
IDENTIFIER_POINTER (dn));
TREE_TYPE (args) = char_array_type_node;
args = fix_string_type (args);
args = build_tree_list (NULL_TREE, args);
}
That code doesn't look like something one would wrote without thinking what the
behavior should be for no arguments, so I believe that it intentionally uses
the name of the namespace in that case.
So, if there is a bug, I'd say just that this is not well documented.