1 // RUN: %clang_cc1 -verify -fsyntax-only -fblocks -Wnullable-to-nonnull-conversion %s
2 // RUN: %clang_cc1 -xobjective-c++ -verify -fsyntax-only -fblocks -Wnullable-to-nonnull-conversion %s
7 _Static_assert(__has_feature(nullability_nullable_result), "");
10 -(void)async_get:(void (^)(X *_Nullable_result rptr, NSError *err))completionHandler;
13 void call(SomeClass *sc) {
14 [sc async_get:^(X *_Nullable_result rptr, NSError *err) {}];
15 [sc async_get:^(X *_Nullable rptr, NSError *err) {}];
18 void test_conversion(void) {
19 X *_Nullable_result nr;
20 X *_Nonnull l = nr; // expected-warning{{implicit conversion from nullable pointer 'X * _Nullable_result' to non-nullable pointer type 'X * _Nonnull'}}
22 (void)^(X * _Nullable_result p) {
23 X *_Nonnull l = p; // expected-warning{{implicit conversion from nullable pointer 'X * _Nullable_result' to non-nullable pointer type 'X * _Nonnull'}}
28 id _Nullable_result _Nullable_result a; // expected-warning {{duplicate nullability specifier '_Nullable_result'}}
29 id _Nullable _Nullable_result b; // expected-error{{nullability specifier '_Nullable_result' conflicts with existing specifier '_Nullable'}}
30 id _Nullable_result _Nonnull c; // expected-error{{nullability specifier '_Nonnull' conflicts with existing specifier '_Nullable_result'}}
33 @interface NoContextSensitive
34 -(nullable_result id)m; // expected-error {{expected a type}}
35 @property(assign, nullable_result) id p; // expected-error{{unknown property attribute 'nullable_result'}}