This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, c++] tweak wording of `unknown type' in error messages


Unknown type is not something that necessarily makes sense to end
users, since it's just an internal representation detail of types yet
to undergo overload resolution.  Some users seemed to be confused at
it, so I figured tweaking the wording a bit could make the problem
clearer.

Tested on amd64-linux-gnu.  Ok to install?

`unknown type' may be confusing and misleading; make it clearer, in
error messages, that it is possible that the type could not be deduced.

Index: gcc/cp/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* error.c (dump_type) <UNKNOWN_TYPE>: Print nondeduced or unknown.

Index: gcc/testsuite/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* g++.dg/overload/unknown1.C: New.
Index: gcc/cp/error.c
===================================================================
--- gcc/cp/error.c.orig	2005-09-23 16:37:14.000000000 -0300
+++ gcc/cp/error.c	2005-09-29 16:20:39.000000000 -0300
@@ -259,7 +259,7 @@
   switch (TREE_CODE (t))
     {
     case UNKNOWN_TYPE:
-      pp_identifier (cxx_pp, "<unknown type>");
+      pp_identifier (cxx_pp, "<nondeduced or unknown type>");
       break;
 
     case TREE_LIST:
Index: gcc/testsuite/g++.dg/overload/unknown1.C
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ gcc/testsuite/g++.dg/overload/unknown1.C	2005-09-29 16:20:40.000000000 -0300
@@ -0,0 +1,9 @@
+// { dg-do compile }
+
+void foo(void);
+int foo(int);
+template <typename T> void bar(T f);
+
+void baz() {
+  bar(foo); // { dg-error "<nondeduced or unknown type>" }
+}
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]