On 10/20/2011 12:32 AM, Jason Merrill wrote:
Surely we should only make this change for function members.
Thanks Gaby and Jason. So, what about the below?
Tested x86_64-linux.
Paolo.
////////////////////
/cp
2011-10-19 Paolo Carlini <[email protected]>
PR c++/31423
PR c++/48630
* typeck2.c (cxx_incomplete_type_diagnostic): Improve error message
for invalid use of member function.
/testsuite
2011-10-19 Paolo Carlini <[email protected]>
PR c++/31423
PR c++/48630
* g++.dg/parse/error43.C: New.
Index: cp/typeck2.c
===================================================================
--- cp/typeck2.c (revision 180227)
+++ cp/typeck2.c (working copy)
@@ -428,8 +428,14 @@ cxx_incomplete_type_diagnostic (const_tree value,
case OFFSET_TYPE:
bad_member:
- emit_diagnostic (diag_kind, input_location, 0,
- "invalid use of member (did you forget the %<&%> ?)");
+ if (DECL_FUNCTION_MEMBER_P (TREE_OPERAND (value, 1)))
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of member function "
+ "(did you forget the %<()%> ?)");
+ else
+ emit_diagnostic (diag_kind, input_location, 0,
+ "invalid use of member "
+ "(did you forget the %<&%> ?)");
break;
case TEMPLATE_TYPE_PARM: