* objc/objc-act.c (adjust_type_for_id_default): Do not allow an
object as parameter. Prevent something like 'NSObject' to be
used as the type for a method argument.
testsuite:
* objc.dg/param-1.m: New test.
From-SVN: r55197
+
+2002-07-02 Devang Patel <dpatel@apple.com
+ * objc/objc-act.c (adjust_type_for_id_default): Do not allow an
+ object as parameter. Prevent something like 'NSObject' to be
+ used as the type for a method argument.
+
2002-07-03 Neil Booth <neil@daikokuya.co.uk>
* cpptrad.c: Update comment.
chain;
chain = TREE_CHAIN (chain))
{
+ if (TREE_CODE (TREE_VALUE (chain)) == RECORD_TYPE
+ && !(TREE_VALUE (type)
+ && TREE_CODE (TREE_VALUE (type)) == INDIRECT_REF))
+ error ("can not use an object as parameter to a method\n");
if (!is_objc_type_qualifier (TREE_VALUE (chain)))
return type;
}
+2002-07-02 Devang Patel <dpatel@apple.com>
+ * objc.dg/param-1.m: New test.
+
2002-07-03 Neil Booth <neil@daikokuya.co.uk>
* gcc.dg/cpp/trad/directive.c: Add test.
--- /dev/null
+/* Test if compiler detects object as an parameter to a method
+ or not. It is not valid. */
+/* { dg-do compile } */
+
+@interface foo
+@end
+
+@implementation foo
+@end
+
+@interface bar
+-(void) my_method:(foo) my_param; /* { dg-error "can not use an object as parameter to a method" } */
+@end
+
+@implementation bar
+-(void) my_method:(foo) my_param /* { dg-error "can not use an object as parameter to a method" } */
+{
+}
+@end
+