diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-11 18:46:17 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-11 18:46:17 +0000 |
commit | d263fd1451299b1e5f5f1acb2bb13b0a4119aee8 (patch) | |
tree | e285db71f901af2f1c0b4a5dd04ef4d38c987569 /lib/AST/ASTContext.cpp | |
parent | 9b555ea217565ac0f8bf7255b29496916cb03476 (diff) |
Fix a block sema bug where result type of initializer
is unqualified but its initialized is qualified.
This is for c only and fixes the imm. problem.
c++ is more involved and is wip.
// rdar://8979379
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ASTContext.cpp')
-rw-r--r-- | lib/AST/ASTContext.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 03c0abd3c6..dcbfd9deec 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -5076,9 +5076,14 @@ QualType ASTContext::mergeFunctionTypes(QualType lhs, QualType rhs, // Check return type QualType retType; - if (OfBlockPointer) - retType = mergeTypes(rbase->getResultType(), lbase->getResultType(), true, - Unqualified); + if (OfBlockPointer) { + QualType RHS = rbase->getResultType(); + QualType LHS = lbase->getResultType(); + bool UnqualifiedResult = Unqualified; + if (!UnqualifiedResult) + UnqualifiedResult = (!RHS.hasQualifiers() && LHS.hasQualifiers()); + retType = mergeTypes(RHS, LHS, true, UnqualifiedResult); + } else retType = mergeTypes(lbase->getResultType(), rbase->getResultType(), false, Unqualified); |