summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorNeil Hickey <neil.hickey@arm.com>2019-07-16 14:57:32 +0000
committerNeil Hickey <neil.hickey@arm.com>2019-07-16 14:57:32 +0000
commitec0a24cf0c4cda22adebd574bb5a9f01e793f657 (patch)
tree336f38bd849b7fa3c1b465aa4dfe0f91cd1469fc /lib/Sema/SemaOverload.cpp
parent15319200cf006cd937d34507e8ad1dce5ce5e8ad (diff)
downloadclang-ec0a24cf0c4cda22adebd574bb5a9f01e793f657.tar.gz
[OpenCL] Fixing sampler initialisations for C++ mode.
Allow conversions between integer and sampler type. Differential Revision: https://reviews.llvm.org/D64791 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOverload.cpp')
-rw-r--r--lib/Sema/SemaOverload.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp
index 77e6767c2b..d8c4ea48eb 100644
--- a/lib/Sema/SemaOverload.cpp
+++ b/lib/Sema/SemaOverload.cpp
@@ -1851,6 +1851,10 @@ static bool IsStandardConversion(Sema &S, Expr* From, QualType ToType,
(From->EvaluateKnownConstInt(S.getASTContext()) == 0)) {
SCS.Second = ICK_Zero_Queue_Conversion;
FromType = ToType;
+ } else if (ToType->isSamplerT() &&
+ From->isIntegerConstantExpr(S.getASTContext())) {
+ SCS.Second = ICK_Compatible_Conversion;
+ FromType = ToType;
} else {
// No second conversion required.
SCS.Second = ICK_Identity;