Commit c40da518 by Devang Patel Committed by Devang Patel

objc-act.c (adjust_type_for_id_default): Do not allow an object as parameter.


      * 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
parent 0879540b
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.
......
......@@ -4465,6 +4465,10 @@ adjust_type_for_id_default (type)
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.
......
/* 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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment