===================================================================
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+@interface SomeClass
++ method:(int)foo;
+@end
+
+int main(void) {
+ [SomeClass method:3, 4]; /* { dg-error "too many arguments to method \\'method:\\'" } */
+ return 0;
+}
===================================================================
@@ -0,0 +1,10 @@
+/* { dg-do compile } */
+
+@interface SomeClass
++ method:(int)foo;
+@end
+
+int main(void) {
+ [SomeClass method:3, 4]; /* { dg-error "too many arguments to method \\'method:\\'" } */
+ return 0;
+}
===================================================================
@@ -3428,8 +3428,17 @@
"declared here");
}
else
- error_at (loc, too_many_p ? G_("too many arguments to function")
- : G_("too few arguments to function"));
+ {
+ if (c_dialect_objc () && objc_message_selector ())
+ error_at (loc,
+ too_many_p
+ ? G_("too many arguments to method %q#D")
+ : G_("too few arguments to method %q#D"),
+ objc_message_selector ());
+ else
+ error_at (loc, too_many_p ? G_("too many arguments to function")
+ : G_("too few arguments to function"));
+ }
}
/* Convert the actual parameter expressions in the list VALUES to the
===================================================================
@@ -2897,8 +2897,13 @@
if (type == void_type_node)
{
- error_at (input_location,
- "too many arguments to function %qE", function);
+ if (selector)
+ error_at (input_location,
+ "too many arguments to method %qE", selector);
+ else
+ error_at (input_location,
+ "too many arguments to function %qE", function);
+
if (fundecl && !DECL_BUILT_IN (fundecl))
inform (DECL_SOURCE_LOCATION (fundecl), "declared here");
return parmnum;