summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2013-06-07 00:48:14 +0000
committerFariborz Jahanian <fjahanian@apple.com>2013-06-07 00:48:14 +0000
commit44d23b85d90cf69b0c584ebd7bafcd1c2ab192bd (patch)
treefe0e434543d0dab8d229d37f7239d46f929d4550 /clang/lib
parent649f8b9b0bc83cce9ebbe8d73e0d14d3bfee2124 (diff)
downloadbcm5719-llvm-44d23b85d90cf69b0c584ebd7bafcd1c2ab192bd.tar.gz
bcm5719-llvm-44d23b85d90cf69b0c584ebd7bafcd1c2ab192bd.zip
blocks: fixes an ast bug when block pointer variable
is evaluated in a condition expression and then dereferenced to envoke the block. This is pr15663 and I applied a slight variation of the patch with a test case. (patch is from Arthur O'Dwyer). Also // rdar://14085217 llvm-svn: 183471
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExpr.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 2a3482238d8..7bbbe72ac31 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -5149,7 +5149,10 @@ static QualType checkConditionalPointerCompatibility(Sema &S, ExprResult &LHS,
// The pointer types are compatible.
QualType ResultTy = CompositeTy.withCVRQualifiers(MergedCVRQual);
- ResultTy = S.Context.getPointerType(ResultTy);
+ if (isa<BlockPointerType>(LHSTy))
+ ResultTy = S.Context.getBlockPointerType(ResultTy);
+ else
+ ResultTy = S.Context.getPointerType(ResultTy);
LHS = S.ImpCastExprToType(LHS.take(), ResultTy, CK_BitCast);
RHS = S.ImpCastExprToType(RHS.take(), ResultTy, CK_BitCast);
OpenPOWER on IntegriCloud