Debian Codegraph @

gcc/testsuite/obj-c++.dg/attributes/nullability-00.mm

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-Wno-objc-root-class -fsyntax-only" } */
3
4 __attribute__((objc_nullability(0))) id a;
5 __attribute__((objc_nullability(4))) id e_1; /* { dg-error {'objc_nullability' attribute argument '4' is not an integer constant between 0 and 3} } */
6 __attribute__((objc_nullability(-22))) id e_2; /* { dg-error {'objc_nullability' attribute argument '-22' is not an integer constant between 0 and 3} } */
7 __attribute__((objc_nullability("unspecified"))) id b;
8 __attribute__((objc_nullability("nullable"))) id c;
9 __attribute__((objc_nullability("nonnull"))) id d;
10 __attribute__((objc_nullability("resettable"))) id e;
11 __attribute__((objc_nullability("nonsense"))) id e_3; /* { dg-error {'objc_nullability' attribute argument '"nonsense"' is not recognized} } */
12 __attribute__((objc_nullability(noGoingToWork))) id e_4; /* { dg-error {'noGoingToWork' was not declared in this scope} } */
13
14 @interface MyRoot
15 {
16 __attribute__((objc_nullability(0))) id iv_a;
17 __attribute__((objc_nullability(3))) struct { int bad_a; } s;/* { dg-error {'objc_nullability' cannot be applied to non-pointer type '<unnamed struct>'} } */
18 __attribute__((objc_nullability("resettable"))) int iv_b;/* { dg-error {'objc_nullability' cannot be applied to non-pointer type 'int'} } */
19 }
20 @end