summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorAnastasia Stulova <anastasia.stulova@arm.com>2019-05-02 16:10:50 +0000
committerAnastasia Stulova <anastasia.stulova@arm.com>2019-05-02 16:10:50 +0000
commit15e8bd3ce55bc36e6e359d069e472464c798d55f (patch)
tree08a7c65e554018f833b287725e0f3006107fe89a /lib/Sema/SemaOverload.cpp
parentc38febbb182950aea135ddba6520186103110074 (diff)
downloadclang-15e8bd3ce55bc36e6e359d069e472464c798d55f.tar.gz
[OpenCL] Fix initialisation of this via pointer.
When the expression used to initialise 'this' has a pointer type, check the address space of the pointee type instead of the pointer type to decide whether an address space cast is required. It is the pointee type that carries the address space qualifier. Fixing PR41674. Patch by kpet (Kevin Petit)! Differential Revision: https://reviews.llvm.org/D61319 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@359798 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 2b0467fa86..6da10ac12d 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -5279,12 +5279,12 @@ Sema::PerformObjectArgumentInitialization(Expr *From,
}
if (!Context.hasSameType(From->getType(), DestType)) {
- if (From->getType().getAddressSpace() != DestType.getAddressSpace())
- From = ImpCastExprToType(From, DestType, CK_AddressSpaceConversion,
- From->getValueKind()).get();
+ CastKind CK;
+ if (FromRecordType.getAddressSpace() != DestType.getAddressSpace())
+ CK = CK_AddressSpaceConversion;
else
- From = ImpCastExprToType(From, DestType, CK_NoOp,
- From->getValueKind()).get();
+ CK = CK_NoOp;
+ From = ImpCastExprToType(From, DestType, CK, From->getValueKind()).get();
}
return From;
}