diff options
author | Jason Merrill <jason@redhat.com> | 2010-06-07 16:43:01 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2010-06-07 16:43:01 -0400 |
commit | b0a421e8c1edf21466756f1354a481273c2cb362 (patch) | |
tree | df8ee9a847339e3a9f935f8ffacc112f1a1d8f9b /gcc/cp/parser.c | |
parent | 01628e543b8867e4c4ca5724d4982caae7f0bc1a (diff) | |
download | gcc-b0a421e8c1edf21466756f1354a481273c2cb362.zip gcc-b0a421e8c1edf21466756f1354a481273c2cb362.tar.gz gcc-b0a421e8c1edf21466756f1354a481273c2cb362.tar.bz2 |
re PR c++/44401 (Doesn't correctly hide injected class name)
PR c++/44401
* parser.c (cp_parser_lookup_name): Fix naming the constructor.
From-SVN: r160399
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index eb347e2..92f7786 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 |