diff options
author | Anastasia Stulova <anastasia.stulova@arm.com> | 2018-11-19 11:00:14 +0000 |
---|---|---|
committer | Anastasia Stulova <anastasia.stulova@arm.com> | 2018-11-19 11:00:14 +0000 |
commit | 7eb6938c48c65f70843cc0351bf816456f7834c4 (patch) | |
tree | 19159896d182148882c34dd8ae38fa53fc04c36c /clang/lib | |
parent | 2775b5caaeab37bffaa530adeac0b639cfbe00d3 (diff) | |
download | bcm5719-llvm-7eb6938c48c65f70843cc0351bf816456f7834c4.tar.gz bcm5719-llvm-7eb6938c48c65f70843cc0351bf816456f7834c4.zip |
[OpenCL] Fix address space deduction in template args.
Don't deduce address spaces for non-pointer-like types
in template args.
Fixes PR38603!
Differential Revision: https://reviews.llvm.org/D54634
llvm-svn: 347189
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaType.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index 8c008bbcc71..97ceaf97ff4 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -7227,7 +7227,9 @@ static void deduceOpenCLImplicitAddrSpace(TypeProcessingState &State, if (IsPointee) { ImpAddr = LangAS::opencl_generic; } else { - if (D.getContext() == DeclaratorContext::FileContext) { + if (D.getContext() == DeclaratorContext::TemplateArgContext) { + // Do not deduce address space for non-pointee type in template args + } else if (D.getContext() == DeclaratorContext::FileContext) { ImpAddr = LangAS::opencl_global; } else { if (D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static || |