[PATCH] D102850: [C++4OpenCL] Fix overloading resolution of addrspace constructors
    Ole Strohm via Phabricator via cfe-commits 
    cfe-commits at lists.llvm.org
       
    Mon May 24 03:36:19 PDT 2021
    
    
  
olestrohm 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)) {
----------------
Anastasia wrote:
> 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?
It's handled in SemaOverload.cpp:10000 in `OverloadCandidateSet::BestViableFunction` which checks if the given function is viable or not. For member functions the address space they're defined in and the address space of the variable have to match. Therefore only one of them is valid at a time and they never get checked against each other in `isBetterOverloadCandidate`.
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