llvm / llvm-project

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

clang 16 bug: unnecessary qualification of symbol demanded. #77309

Open hatcat opened 10 months ago

hatcat commented 10 months ago

I believe I have found a bug in the 16.0.0 (assertions) version, minimum repro with comparisons with other compilers here

This is also visible in Apple clang version 15.0.0 (clang-1500.1.0.2.5)

template <typename T> concept copyable = true;

template <copyable T> void get(T) { }

template <typename X>
struct base
{
    template <copyable T> friend void get(T);
};

void test1()
{
    base<int> b;
    get(b);               // Scope resolution demanded
}
EugeneZelenko commented 10 months ago

Trunk seems to compile your example: https://godbolt.org/z/j8WhdsrPK. Patches are not backported even to 17 anymore.

llvmbot commented 10 months ago

@llvm/issue-subscribers-clang-frontend

Author: J Guy Davidson (hatcat)

I believe I have found a bug in the 16.0.0 (assertions) version, minimum repro with comparisons with other compilers [here](https://godbolt.org/z/MPGG35jhc) This is also visible in Apple clang version 15.0.0 (clang-1500.1.0.2.5) ```c++ template <typename T> concept copyable = true; template <copyable T> void get(T) { } template <typename X> struct base { template <copyable T> friend void get(T); }; void test1() { base<int> b; get(b); // Scope resolution demanded } ```
shafik commented 10 months ago

It looks like this was broken between clang-15 and clang-17: https://godbolt.org/z/o9rhWKEMK

Let me CC some folks who might have more insights on the apple-clang side of things.

CC @Bigcheese @ldionne @rjmccall

ldionne commented 10 months ago

@hatcat Since it looks like this is not an issue on Clang trunk, it's only an issue for the Apple-released version of Clang. The best way to move this forward would be to file a bug report with Apple using https://feedbackassistant.apple.com, however at this point it may be easier to just wait for the fix to be ingested naturally in an upcoming Xcode release, since those are generally not too far behind upstream LLVM.