[OpenCL] Fix default address space in template argument deduction.
authorAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 4 Feb 2021 13:46:11 +0000 (13:46 +0000)
committerAnastasia Stulova <anastasia.stulova@arm.com>
Thu, 4 Feb 2021 13:51:53 +0000 (13:51 +0000)
commit0c65993be186640463ac90415113474d35889dbb
tree2d6301b40016686428f4620f75ba07ed9a2f323e
parent09c18a6606e1437234fc1ac9f75b32c168a2d05b
[OpenCL] Fix default address space in template argument deduction.

When deducing a reference type for forwarding references prevent
adding default address space of a template argument if it is given.

This got reported in PR48896 because in OpenCL all parameters are
in private address space and therefore when we initialize a
forwarding reference with a parameter we should just inherit the
address space from it i.e. keep __private instead of __generic.

Tags: #clang

Differential Revision: https://reviews.llvm.org/D95624
clang/lib/Sema/SemaTemplateDeduction.cpp
clang/test/SemaOpenCLCXX/address-space-templates.cl