This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, c++] tweak wording of `unknown type' in error messages
On Oct 1, 2005, Jason Merrill <jason@redhat.com> wrote:
> Alexandre Oliva wrote:
>> So how about `<non-deducible overloaded function type>'?
> Again, I think anything involving "deduce" is misleading, because this
> has nothing to do with template argument deduction, and that's the
> only place in the standard that uses that term.
Indeed. I was thinking the error would only occur when there was a
failure to deduce template arguments. However, not only does that
hardly make the message I proposed defensible, but also it doesn't
cover all cases.
> I'd be content with <unresolved overloaded function type>.
Me too. Ok to install this? Tested on amd64-linux-gnu.
`unknown type' may be confusing and misleading; make it clearer, in
error messages, that the type of an overloaded function could not be
resolved.
Index: gcc/cp/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* error.c (dump_type) <UNKNOWN_TYPE>: Print reworded message.
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-10-03 13:33:09.000000000 -0300
+++ gcc/cp/error.c 2005-10-03 13:33:14.000000000 -0300
@@ -259,7 +259,7 @@
switch (TREE_CODE (t))
{
case UNKNOWN_TYPE:
- pp_identifier (cxx_pp, "<unknown type>");
+ pp_identifier (cxx_pp, "<unresolved overloaded function 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-10-03 13:33:14.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 "<unresolved overloaded function 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}