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

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Thu May 2 05:44:31 PDT 2024


sdkrystian wrote:

This still doesn't handle cases such as:
```cpp
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 be79079507ffbd9b29683498f405dc2c32dd8ba7)

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


More information about the cfe-commits mailing list