diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b46530878d4..2a381230426 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2007-03-22 Gabriel Dos Reis + + * 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 * cp-tree.def, parser.c, pt.c: Fix comment typos. diff --git a/gcc/cp/cxx-pretty-print.c b/gcc/cp/cxx-pretty-print.c index e250bf78a2f..ac75e1def8e 100644 --- a/gcc/cp/cxx-pretty-print.c +++ b/gcc/cp/cxx-pretty-print.c @@ -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; diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 41a7e1d0d20..27bcecf9ee4 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -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. */ diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 2cf6f8a71d8..41e7b52f980 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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;