[cfe-commits] r71183 - in /cfe/trunk: lib/Sema/SemaType.cpp test/Sema/block-misc.c
Mike Stump
mrs at apple.com
Thu May 7 14:56:18 PDT 2009
Author: mrs
Date: Thu May 7 16:56:17 2009
New Revision: 71183
URL: http://llvm.org/viewvc/llvm-project?rev=71183&view=rev
Log:
Allow qualifiers on blocks. Radar 6441502
Modified:
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/Sema/block-misc.c
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=71183&r1=71182&r2=71183&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu May 7 16:56:17 2009
@@ -666,12 +666,11 @@
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);
Modified: cfe/trunk/test/Sema/block-misc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/block-misc.c?rev=71183&r1=71182&r2=71183&view=diff
==============================================================================
--- cfe/trunk/test/Sema/block-misc.c (original)
+++ cfe/trunk/test/Sema/block-misc.c Thu May 7 16:56:17 2009
@@ -180,3 +180,8 @@
(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}}
+}
More information about the cfe-commits
mailing list