clang/test/SemaObjC/access-property-getter.m
raw| 1 | // RUN: %clang_cc1 -verify %s |
| 2 | |
| 3 | @protocol Protocol |
| 4 | - (oneway void) method; |
| 5 | @end |
| 6 | |
| 7 | void accessMethodViaPropertySyntaxAndTriggerWarning(id<Protocol> object) { |
| 8 | object.method; // expected-warning {{property access result unused - getters should not be used for side effects}} |
| 9 | } |
| 10 | |
| 11 | #pragma clang diagnostic ignored "-Wunused-getter-return-value" |
| 12 | |
| 13 | void accessMethodViaPropertySyntaxWhenWarningIsIgnoredDoesNotTriggerWarning(id<Protocol> object) { |
| 14 | object.method; |
| 15 | } |
| 16 |