aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2009-11-16 18:29:25 -0500
committerJason Merrill <jason@gcc.gnu.org>2009-11-16 18:29:25 -0500
commit5a080ad7b0dc031e2b2c7f49fdb0ebf7d3d35514 (patch)
treed01fd61cab03b29407d10ef9f75bd71d4bae928a /gcc/cp/decl.c
parent87213cd4965fb065bf1e57f6acd34df1695fedc0 (diff)
downloadgcc-5a080ad7b0dc031e2b2c7f49fdb0ebf7d3d35514.zip
gcc-5a080ad7b0dc031e2b2c7f49fdb0ebf7d3d35514.tar.gz
gcc-5a080ad7b0dc031e2b2c7f49fdb0ebf7d3d35514.tar.bz2
PR c++/13950, DR 176
PR c++/13950, DR 176 * search.c (lookup_field_r): Allow lookup to find the injected-class-name from a template base. (template_self_reference_p): Remove. * decl.c (make_typename_type): Diagnose ambiguity. Use maybe_get_template_decl_from_type_decl. * parser.c (cp_parser_template_name): Pass true to is_template rather than use maybe_get_template_decl_from_type_decl. (cp_parser_lookup_name): Use maybe_get_template_decl_from_type_decl. * pt.c (maybe_get_template_decl_from_type_decl): Handle ambiguity. Use DECL_SELF_REFERENCE_P. * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Avoid duplicate ambiguity error. * error.c (dump_decl): Don't say "typedef" for injected-class-name. * pt.c (convert_template_argument): Tweak logic. From-SVN: r154223
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 73bf995..851edeb 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3040,11 +3040,11 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
if (!dependent_scope_p (context))
/* We should only set WANT_TYPE when we're a nested typename type.
Then we can give better diagnostics if we find a non-type. */
- t = lookup_field (context, name, 0, /*want_type=*/true);
+ t = lookup_field (context, name, 2, /*want_type=*/true);
else
t = NULL_TREE;
- if (!t && dependent_type_p (context))
+ if ((!t || TREE_CODE (t) == TREE_LIST) && dependent_type_p (context))
return build_typename_type (context, name, fullname, tag_type);
want_template = TREE_CODE (fullname) == TEMPLATE_ID_EXPR;
@@ -3057,6 +3057,20 @@ make_typename_type (tree context, tree name, enum tag_types tag_type,
return error_mark_node;
}
+ /* Pull out the template from an injected-class-name (or multiple). */
+ if (want_template)
+ t = maybe_get_template_decl_from_type_decl (t);
+
+ if (TREE_CODE (t) == TREE_LIST)
+ {
+ if (complain & tf_error)
+ {
+ error ("lookup of %qT in %qT is ambiguous", name, context);
+ print_candidates (t);
+ }
+ return error_mark_node;
+ }
+
if (want_template && !DECL_CLASS_TEMPLATE_P (t))
{
if (complain & tf_error)