[PATCH] D83665: [OpenCL] Fixed missing address space for templated copy constructor

Ole Strohm via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 13 03:25:28 PDT 2020


olestrohm created this revision.
olestrohm added reviewers: Anastasia, rjmccall.
olestrohm added a project: clang.
Herald added subscribers: cfe-commits, yaxunl.

When you have a templated constructor with an R-value reference the compiler implicitly creates a copy and move constructor through the template constructor, and the copy constructor created this way was missing an address space in the reference parameter. I've come up with this fix that deduces the address space for the reference parameter right before it's created, and a corresponding test.

The test is quite big, but rep_outer is necessary to force the compiler to create the copy constructor, and the two template structs are partly for readability.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83665

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaTemplateDeduction.cpp
  clang/lib/Sema/SemaType.cpp
  clang/test/SemaOpenCLCXX/address-space-templates.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83665.277369.patch
Type: text/x-patch
Size: 4271 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200713/da83bf7d/attachment.bin>


More information about the cfe-commits mailing list