llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.58k stars 11.34k forks source link

[OpenMP] overloading resolution issue involving namespace #83041

Open yxsamliu opened 5 months ago

yxsamliu commented 5 months ago

In the following example:

https://godbolt.org/z/eo1hx3a6W

#pragma omp begin declare variant match(device = {arch(amdgcn)})
  int foo() { return 1;}
#pragma omp end declare variant

//int foo() { return 2;}

namespace FOAM {
    int foo() { return 3;}
}

int main(){
    using namespace FOAM;
    return foo();
}

when resolving foo in main, device variant should not be considered candidate. However, when FOAM::foo is introduced, device variant becomes a candidate, which cause ambiguity. This should not happen.

@jhuber6

llvmbot commented 5 months ago

@llvm/issue-subscribers-clang-frontend

Author: Yaxun (Sam) Liu (yxsamliu)

In the following example: https://godbolt.org/z/eo1hx3a6W ``` #pragma omp begin declare variant match(device = {arch(amdgcn)}) int foo() { return 1;} #pragma omp end declare variant //int foo() { return 2;} namespace FOAM { int foo() { return 3;} } int main(){ using namespace FOAM; return foo(); } ``` when resolving foo in main, device variant should not be considered candidate. However, when FOAM::foo is introduced, device variant becomes a candidate, which cause ambiguity. This should not happen. @jhuber6
jhuber6 commented 5 months ago

I unfortunately don't know anything about the underlying implementation here. I believe that was handled by @jdoerfert.