[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 07:14:23 PDT 2024


jcsxky wrote:

> This still doesn't handle cases such as:
> 
> ```c++
> template<typename T, typename U, typename V, typename W>
> concept E = sizeof(T) == sizeof(U) && sizeof(V) == sizeof(W);
> 
> template<typename T> // T = char
> struct A
> {
>     template<typename U> // U = signed char
>     struct B
>     {
>         template<typename V, typename W, typename X> // V = int, W = int, X = short
>         requires E<T, U, V, W> // incorrectly substitutes T = int, U = short, V = int, V = int
>         static void f();
>     };
> };
> 
> 
> template<typename T, typename U> // T = int, U = int
> struct C
> {
>     template<typename V> // V = short
>     struct D
>     {
>         friend void A<char>::B<signed char>::f<T, U, V>();
>     };
> };
> 
> template struct C<int, int>::D<short>;
> 
> extern template void A<char>::B<signed char>::f<int, int, short>();
> ```
> 
> (which is handled by [be79079](https://github.com/llvm/llvm-project/commit/be79079507ffbd9b29683498f405dc2c32dd8ba7))

Thanks for your patience and testcases! They really make me understand these related issues more clearly.

https://github.com/llvm/llvm-project/pull/90646


More information about the cfe-commits mailing list