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)) {
----------------
olestrohm wrote:
> 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`.
I am quite sure that for the example above both `__private` and `__generic 
`overloads are viable. In fact, if you remove the `__private` overload the 
`__generic` one gets picked.

So I think the logic should be checking for compatibility rather than the exact 
match i.e. using `isAddressSpaceSupersetOf` although it might not be calling 
that helper directly but through the other Qualifier logic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102850

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to