This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Clarify error message
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Clarify error message
- From: Jakub Jelinek <jakub at redhat dot com>
- Date: Wed, 14 Feb 2001 15:33:51 +0100
- Reply-To: Jakub Jelinek <jakub at redhat dot com>
Hi!
Some users are confused about the
ISO C++ forbids taking the address of a non-static member
function to form a pointer to member function. Say ...
message, because the error message suggests doing exactly that
(ie. taking address of a non-static member function), the thing which
matters is that you cannot take address of an unqualified id of such
function.
Would wording like below be ok?
2001-02-14 Jakub Jelinek <jakub@redhat.com>
* typeck.c (build_unary_op): Clarify error message.
--- gcc/cp/typeck.c.jj Wed Feb 14 01:39:02 2001
+++ gcc/cp/typeck.c Wed Feb 14 16:20:06 2001
@@ -4652,9 +4652,9 @@ build_unary_op (code, xarg, noconvert)
if (current_class_type
&& TREE_OPERAND (arg, 0) == current_class_ref)
/* An expression like &memfn. */
- cp_pedwarn ("ISO C++ forbids taking the address of a non-static member function to form a pointer to member function. Say `&%T::%D'", base, name);
+ cp_pedwarn ("ISO C++ forbids taking the address of an unqualified non-static member function to form a pointer to member function. Say `&%T::%D'", base, name);
else
- cp_pedwarn ("ISO C++ forbids taking the address of a bound member function to form a pointer to member function. Say `&%T::%D'", base, name);
+ cp_pedwarn ("ISO C++ forbids taking the address of an unqualified bound member function to form a pointer to member function. Say `&%T::%D'", base, name);
}
arg = build_offset_ref (base, name);
}
Jakub