[PATCH] D102850: [C++4OpenCL] Fix overloading resolution of addrspace constructors

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 21 08:29:21 PDT 2021


Anastasia added inline comments.


================
Comment at: clang/lib/Sema/SemaOverload.cpp:9870
 
+  if (S.getLangOpts().OpenCL) {
+    if (const auto *CD1 = dyn_cast_or_null<CXXConstructorDecl>(Cand1.Function)) {
----------------
I think we should remove the OpenCL check since it is not OpenCL specific rule and you are using common helpers indeed!

I also wonder if this should be applied to all member functions not only ctors since `isBetterOverloadCandidate` should be used for everything?

However it seems that other members are already handled somehow https://godbolt.org/z/MrWKPKed7. Do you know where this handling comes from?


================
Comment at: clang/test/CodeGenOpenCLCXX/addrspace-constructors.clcpp:14
   // Local variables are handled in local_addrspace_init.clcpp
-  // FIXME: __private and __generic constructors clash for __private variable
-  // X() /*__generic*/ = default;
+  X() /*__generic*/ = default;
   X() __private : x(0) {}
----------------
Let's add a `CHECK` to make sure that the overload with the specific address space is used.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102850/new/

https://reviews.llvm.org/D102850



More information about the cfe-commits mailing list