diff options
Diffstat (limited to 'gcc/testsuite/obj-c++.dg/attributes/categ-attribute-2.mm')
-rw-r--r-- | gcc/testsuite/obj-c++.dg/attributes/categ-attribute-2.mm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/obj-c++.dg/attributes/categ-attribute-2.mm b/gcc/testsuite/obj-c++.dg/attributes/categ-attribute-2.mm new file mode 100644 index 000000000..d2fb78913 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/categ-attribute-2.mm @@ -0,0 +1,32 @@ +/* { dg-do compile } */ + +#include <objc/objc.h> +#include "../../objc-obj-c++-shared/Object1.h" + +@interface obj : Object { +@public + int var; +} +- (int) mth; +@end + +@implementation obj +- (int) mth { return var; } +@end + +__attribute__ ((deprecated("no dep_categ"))) +@interface obj (dep_categ) /* { dg-warning "category attributes are not available in this version" } */ +- (int) depmth; +@end + +__attribute__ ((deprecated)) +@implementation obj (dep_categ) /* { dg-warning "prefix attributes are ignored before" } */ +- (int) depmth { return var + 1; } +@end + +int foo (void) +{ + obj *p = [obj new]; + int q = [p depmth]; + return [p mth]; +} |