File tree 3 files changed +6
-3
lines changed
3 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -2751,6 +2751,7 @@ void Parser::ParseBlockId(SourceLocation CaretLoc) {
2751
2751
2752
2752
// Parse the block-declarator.
2753
2753
Declarator DeclaratorInfo (DS, Declarator::BlockLiteralContext);
2754
+ DeclaratorInfo.setFunctionDefinitionKind (FDK_Definition);
2754
2755
ParseDeclarator (DeclaratorInfo);
2755
2756
2756
2757
MaybeParseGNUAttributes (DeclaratorInfo);
@@ -2789,6 +2790,7 @@ ExprResult Parser::ParseBlockLiteralExpression() {
2789
2790
// Parse the return type if present.
2790
2791
DeclSpec DS (AttrFactory);
2791
2792
Declarator ParamInfo (DS, Declarator::BlockLiteralContext);
2793
+ ParamInfo.setFunctionDefinitionKind (FDK_Definition);
2792
2794
// FIXME: Since the return type isn't actually parsed, it can't be used to
2793
2795
// fill ParamInfo with an initial valid range, so do it manually.
2794
2796
ParamInfo.SetSourceRange (SourceRange (Tok.getLocation (), Tok.getLocation ()));
Original file line number Diff line number Diff line change @@ -14,7 +14,8 @@ void foo() {
14
14
void (^block)() = // expected-warning {{this function declaration is not a prototype}}
15
15
^void (int arg) { // no warning
16
16
};
17
- void (^block2)(void ) = // no warning
18
- ^void () { // expected-warning {{this function declaration is not a prototype}}
17
+ void (^block2)(void ) = ^void () { // no warning
18
+ };
19
+ void (^block3)(void ) = ^ { // no warning
19
20
};
20
21
}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ - (void)test
24
24
return ;
25
25
};
26
26
void (^simpleBlock5)() = ^ const void { // expected-error {{incompatible block pointer types initializing 'void (^)()' with an expression of type 'const void (^)(void)'}}
27
- return ;
27
+ return ; // expected-warning@-1 {{function cannot return qualified void type 'const void'}}
28
28
};
29
29
void (^simpleBlock6)() = ^ const (void ) { // expected-warning {{'const' qualifier on omitted return type '<dependent type>' has no effect}}
30
30
return ;
You can’t perform that action at this time.
0 commit comments