aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/objc.dg/attributes/categ-attribute-1.m
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/objc.dg/attributes/categ-attribute-1.m')
-rw-r--r--gcc/testsuite/objc.dg/attributes/categ-attribute-1.m31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/objc.dg/attributes/categ-attribute-1.m b/gcc/testsuite/objc.dg/attributes/categ-attribute-1.m
new file mode 100644
index 0000000..e9fe9c9
--- /dev/null
+++ b/gcc/testsuite/objc.dg/attributes/categ-attribute-1.m
@@ -0,0 +1,31 @@
+/* { 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))
+@interface obj (dep_categ)
+- (int) depmth;/* { dg-warning "category attributes are not available in this version" } */
+@end
+
+@implementation obj (dep_categ)
+- (int) depmth { return var + 1; }
+@end
+
+int foo (void)
+{
+ obj *p = [obj new];
+ int q = [p depmth];
+ return [p mth];
+}