diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-06-16 22:34:44 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-06-16 22:34:44 +0000 |
commit | 6c91615e5d67d59e752037beb475c4b827431172 (patch) | |
tree | 7d2b1168f27c5ef0eb8fe5f83f63cac2bc9af6ab | |
parent | 70f55bb1046b6b2a0fb5db78582a840cec5ac8c2 (diff) |
For the purpose of @encode'ing, accept 'void' type
(even though it is incomplete type) because gcc
says so. // rdar://9622422
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133208 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Sema/SemaExprObjC.cpp | 3 | ||||
-rw-r--r-- | test/CodeGenObjC/encode-test.m | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp index 1d1f6aeb34..70eb2a3c72 100644 --- a/lib/Sema/SemaExprObjC.cpp +++ b/lib/Sema/SemaExprObjC.cpp @@ -128,7 +128,8 @@ ExprResult Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, if (EncodedType->isDependentType()) StrTy = Context.DependentTy; else { - if (!EncodedType->getAsArrayTypeUnsafe()) // Incomplete array is handled. + if (!EncodedType->getAsArrayTypeUnsafe() && //// Incomplete array is handled. + !EncodedType->isVoidType()) // void is handled too. if (RequireCompleteType(AtLoc, EncodedType, PDiag(diag::err_incomplete_type_objc_at_encode) << EncodedTypeInfo->getTypeLoc().getSourceRange())) diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index ade0c61822..f30fb26a1e 100644 --- a/test/CodeGenObjC/encode-test.m +++ b/test/CodeGenObjC/encode-test.m @@ -161,3 +161,7 @@ struct f // CHECK: @g10 = constant [14 x i8] c"{f=i[0{?=}]i}\00" const char g10[] = @encode(struct f); + +// rdar://9622422 +// CHECK: @g11 = constant [2 x i8] c"v\00" +const char g11[] = @encode(void); |