1// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only
2
3@interface NSObject
4@end
5
6@interface Test : NSObject
7- (void)test;
8@end
9
10@implementation Test
11- (void)test
12{
13  void (^simpleBlock)() = ^ _Nonnull { //expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}}
14    return;
15  };
16  void (^simpleBlock2)() = ^ _Nonnull void { //expected-error {{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'void'}}
17    return;
18  };
19  void (^simpleBlock3)() = ^ _Nonnull (void) {  //expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}}
20    return;
21  };
22
23  void (^simpleBlock4)() = ^ const { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
24    return;
25  };
26  void (^simpleBlock5)() = ^ const void { //expected-error {{incompatible block pointer types initializing 'void (^)()' with an expression of type 'const void (^)(void)'}}
27    return; // expected-warning@-1 {{function cannot return qualified void type 'const void'}}
28  };
29  void (^simpleBlock6)() = ^ const (void) { //expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
30    return;
31  };
32  void (^simpleBlock7)() = ^ _Nonnull __attribute__((align_value(128))) _Nullable const (void) { // expected-warning {{attribute '_Nullable' ignored, because it cannot be applied to omitted return type}} \
33    // expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}} \
34    // expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}} \
35    // expected-warning {{'align_value' attribute only applies to variables and typedefs}}
36    return;
37  };
38  void (^simpleBlock9)() = ^ __attribute__ ((align_value(128))) _Nonnull const (void) { // expected-warning {{attribute '_Nonnull' ignored, because it cannot be applied to omitted return type}} \
39    // expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}} \
40    // expected-warning {{'align_value' attribute only applies to variables and typedefs}}
41    return;
42  };
43}
44@end
45