summaryrefslogtreecommitdiffstats
path: root/clang/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
commit8ece3b6719948a08d1f654d97f53dbd08891199d (patch)
tree1412390fe24e2b78182f07c0995fcb0430aaca4a /clang/lib/Sema/SemaOverload.cpp
parent655cb4a2d702b70899f3ad384d047537e02698d8 (diff)
downloadbcm5719-llvm-8ece3b6719948a08d1f654d97f53dbd08891199d.tar.gz
bcm5719-llvm-8ece3b6719948a08d1f654d97f53dbd08891199d.zip
[OpenCL] Fixing sampler initialisations for C++ mode.
Allow conversions between integer and sampler type. Differential Revision: https://reviews.llvm.org/D64791 llvm-svn: 366212
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 77e6767c2b8..d8c4ea48ebc 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud