forked from OSchip/llvm-project
Allow qualifiers on blocks. Radar 6441502
llvm-svn: 71183
This commit is contained in:
parent
ba53fe98e7
commit
5e16a0d9e7
|
@ -666,12 +666,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) {
|
|||
if (!LangOpts.Blocks)
|
||||
Diag(DeclType.Loc, diag::err_blocks_disable);
|
||||
|
||||
if (DeclType.Cls.TypeQuals)
|
||||
Diag(D.getIdentifierLoc(), diag::err_qualified_block_pointer_type);
|
||||
if (!T.getTypePtr()->isFunctionType())
|
||||
Diag(D.getIdentifierLoc(), diag::err_nonfunction_block_type);
|
||||
else
|
||||
T = Context.getBlockPointerType(T);
|
||||
T = (Context.getBlockPointerType(T)
|
||||
.getQualifiedType(DeclType.Cls.TypeQuals));
|
||||
break;
|
||||
case DeclaratorChunk::Pointer:
|
||||
T = BuildPointerType(T, DeclType.Ptr.TypeQuals, DeclType.Loc, Name);
|
||||
|
|
|
@ -180,3 +180,8 @@ void test17() {
|
|||
(void)(1 < bp); // expected-error {{invalid operands to binary expression}}
|
||||
(void)(0 < bp); // expected-error {{invalid operands to binary expression}}
|
||||
}
|
||||
|
||||
void test18() {
|
||||
void (^const blockA)(void) = ^{ };
|
||||
blockA = ^{ }; // expected-error {{read-only variable is not assignable}}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue