aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaExprObjC.cpp3
-rw-r--r--test/CodeGenObjC/encode-test.m4
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);