OSDN Git Service

* error.c (dump_expr): Handle dependent names that designate types.
authorgdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Mar 2007 02:58:46 +0000 (02:58 +0000)
committergdr <gdr@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Mar 2007 02:58:46 +0000 (02:58 +0000)
* cxx-pretty-print.c (pp_cxx_unqualified_id): Handle TYPENAME_TYPE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123148 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/cxx-pretty-print.c
gcc/cp/error.c
gcc/cp/parser.c

index b465308..2a38123 100644 (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.
index e250bf7..ac75e1d 100644 (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;
index 41a7e1d..27bcecf 100644 (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.  */
index 2cf6f8a..41e7b52 100644 (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;