Commit b0a421e8 by Jason Merrill Committed by Jason Merrill

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
parent 01628e54
2010-06-07 Jason Merrill <jason@redhat.com>
PR c++/44401
* parser.c (cp_parser_lookup_name): Fix naming the constructor.
* cp-tree.h (COMPLETE_OR_OPEN_TYPE_P): New macro.
* init.c (build_offset_ref): Use it.
* pt.c (maybe_process_partial_specialization): Use it.
......
......@@ -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
......
2010-06-07 Jason Merrill <jason@redhat.com>
PR c++/44401
* g++.dg/tc1/dr147.C: Test case of member with same name as class.
2010-06-07 Jakub Jelinek <jakub@redhat.com>
PR c++/44444
......
......@@ -54,3 +54,13 @@ struct D: C::C
{
D(): C::C() { }
};
// And if lookup doesn't find the injected-class-name, we aren't naming the
// constructor (c++/44401).
struct E
{
int E;
};
int E::*p = &E::E;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment