summaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-07 20:43:01 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2010-06-07 20:43:01 +0000
commit49c8ed9f001a61cac64164910410a4eb7ea148ed (patch)
treedf8ee9a847339e3a9f935f8ffacc112f1a1d8f9b /gcc/cp/parser.c
parent869dcfe4e732da27f580387d0caf1d494b114d60 (diff)
downloadgcc-49c8ed9f001a61cac64164910410a4eb7ea148ed.tar.gz
PR c++/44401
* parser.c (cp_parser_lookup_name): Fix naming the constructor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160399 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index eb347e24bae..92f778619eb 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -18365,6 +18365,14 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
if (dependent_p)
pushed_scope = push_scope (parser->scope);
+ /* If the PARSER->SCOPE is a template specialization, it
+ may be instantiated during name lookup. In that case,
+ errors may be issued. Even if we rollback the current
+ tentative parse, those errors are valid. */
+ decl = lookup_qualified_name (parser->scope, name,
+ tag_type != none_type,
+ /*complain=*/true);
+
/* 3.4.3.1: In a lookup in which the constructor is an acceptable
lookup result and the nested-name-specifier nominates a class C:
* if the name specified after the nested-name-specifier, when
@@ -18380,17 +18388,11 @@ cp_parser_lookup_name (cp_parser *parser, tree name,
shall be used only in the declarator-id of a declaration that
names a constructor or in a using-declaration. */
if (tag_type == none_type
- && CLASS_TYPE_P (parser->scope)
- && constructor_name_p (name, parser->scope))
- name = ctor_identifier;
-
- /* If the PARSER->SCOPE is a template specialization, it
- may be instantiated during name lookup. In that case,
- errors may be issued. Even if we rollback the current
- tentative parse, those errors are valid. */
- decl = lookup_qualified_name (parser->scope, name,
- tag_type != none_type,
- /*complain=*/true);
+ && DECL_SELF_REFERENCE_P (decl)
+ && same_type_p (DECL_CONTEXT (decl), parser->scope))
+ decl = lookup_qualified_name (parser->scope, ctor_identifier,
+ tag_type != none_type,
+ /*complain=*/true);
/* If we have a single function from a using decl, pull it out. */
if (TREE_CODE (decl) == OVERLOAD