This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Section 3.4.4 of the C++ standard states that a lookup for an elaborated type specifier obeys the normal lookup rules except that non-type names are ignored. In particular, the same name declared in multiple namespaces nominated via using directives should result in ambiguous lookups. This was not happening in cases where the class or enumerator name was hidden in one namespace.
This patch fixes this by shifting the scope_binding type member into the value member when the value member is ignored. It also removes the select_decl function in preference to ambiguous_decl and cleans up a few ambiguous reference error messages which were interfering with the new tests.
* name-lookup.c (ambiguous_decl): Fix case when new->value is hidden. (select_decl): Remove function. (unqualified_namespace_lookup): Populate binding by calling ambiguous_decl. Remove select_decl call. (lookup_qualified_name): Remove select_decl call. * decl.c (lookup_and_check_tag): Check for ambiguous references. * parser.c (cp_parser_elaborated_type_specifier): Skip redundant error generation when name lookup is ambiguous.
* g++.dg/lookup/using16.C: New test. * g++.dg/lookup/using17.C: New test.
Attachment:
using-directive.patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |