error.c (dump_expr): Handle dependent names that designate types.

* error.c (dump_expr): Handle dependent names that designate types.
	* cxx-pretty-print.c (pp_cxx_unqualified_id): Handle TYPENAME_TYPE.

From-SVN: r123148
This commit is contained in:
Gabriel Dos Reis 2007-03-23 02:58:46 +00:00 committed by Gabriel Dos Reis
parent ecee68026b
commit 5a023baa1f
4 changed files with 39 additions and 10 deletions

View File

@ -1,3 +1,8 @@
2007-03-22 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (dump_expr): Handle dependent names that designate types.
* cxx-pretty-print.c (pp_cxx_unqualified_id): Handle TYPENAME_TYPE.
2007-03-17 Kazu Hirata <kazu@codesourcery.com>
* cp-tree.def, parser.c, pt.c: Fix comment typos.

View File

@ -129,7 +129,9 @@ pp_cxx_template_id (cxx_pretty_printer *pp, tree t)
pp_cxx_end_template_argument_list (pp);
}
/* unqualified-id:
/* Prints the unqualified part of the id-expression T.
unqualified-id:
identifier
operator-function-id
conversion-function-id
@ -204,6 +206,10 @@ pp_cxx_unqualified_id (cxx_pretty_printer *pp, tree t)
pp_cxx_unqualified_id (pp, TEMPLATE_PARM_DECL (t));
break;
case TYPENAME_TYPE:
pp_cxx_unqualified_id (pp, TYPE_NAME (t));
break;
default:
pp_unsupported_tree (pp, t);
break;

View File

@ -1987,6 +1987,24 @@ dump_expr (tree t, int flags)
pp_cxx_identifier (cxx_pp, "...");
break;
case RECORD_TYPE:
case UNION_TYPE:
case ENUMERAL_TYPE:
case REAL_TYPE:
case VOID_TYPE:
case BOOLEAN_TYPE:
case INTEGER_TYPE:
case COMPLEX_TYPE:
case VECTOR_TYPE:
pp_type_specifier_seq (cxx_pp, t);
break;
case TYPENAME_TYPE:
/* We get here when we want to print a dependent type as an
id-expression, without any disambiguator decoration. */
pp_id_expression (cxx_pp, t);
break;
/* This list is incomplete, but should suffice for now.
It is very important that `sorry' does not call
`report_error_function'. That could cause an infinite loop. */

View File

@ -2054,26 +2054,26 @@ cp_parser_name_lookup_error (cp_parser* parser,
if (decl == error_mark_node)
{
if (parser->scope && parser->scope != global_namespace)
error ("%<%D::%D%> has not been declared",
error ("%<%E::%E%> has not been declared",
parser->scope, name);
else if (parser->scope == global_namespace)
error ("%<::%D%> has not been declared", name);
error ("%<::%E%> has not been declared", name);
else if (parser->object_scope
&& !CLASS_TYPE_P (parser->object_scope))
error ("request for member %qD in non-class type %qT",
error ("request for member %qE in non-class type %qT",
name, parser->object_scope);
else if (parser->object_scope)
error ("%<%T::%D%> has not been declared",
error ("%<%T::%E%> has not been declared",
parser->object_scope, name);
else
error ("%qD has not been declared", name);
error ("%qE has not been declared", name);
}
else if (parser->scope && parser->scope != global_namespace)
error ("%<%D::%D%> %s", parser->scope, name, desired);
error ("%<%E::%E%> %s", parser->scope, name, desired);
else if (parser->scope == global_namespace)
error ("%<::%D%> %s", name, desired);
error ("%<::%E%> %s", name, desired);
else
error ("%qD %s", name, desired);
error ("%qE %s", name, desired);
}
/* If we are parsing tentatively, remember that an error has occurred
@ -12176,7 +12176,7 @@ cp_parser_direct_declarator (cp_parser* parser,
/*only_current_p=*/false);
/* If that failed, the declarator is invalid. */
if (type == error_mark_node)
error ("%<%T::%D%> is not a type",
error ("%<%T::%E%> is not a type",
TYPE_CONTEXT (qualifying_scope),
TYPE_IDENTIFIER (qualifying_scope));
qualifying_scope = type;