>> diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-friend18.C 
>> b/gcc/testsuite/g++.dg/cpp2a/concepts-friend18.C
>> new file mode 100644
>> index 00000000000..5a6b0d67ef7
>> --- /dev/null
>> +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-friend18.C
>> @@ -0,0 +1,18 @@
>> +// PR c++/122550
>> +// { dg-do compile { target c++20 } }
>> +
>> +class Hasher;
>> +template <class a>
>> +concept C = true;
>> +
>> +template<C T>
>> +void add(Hasher&, T);
>> +
>> +struct Hasher {
>> +    template<C T>
>> +    friend void add(Hasher& hasher, T integer) {}
>> +};
>> +
>> +void f(Hasher& hasher, unsigned long integer) {
>> +  add(hasher, (unsigned int) integer);
>> +}
>
> Can you add another version of this test where the friend is defined
> inside an explicit specialization of (the now class template) Hasher?
> This would demonstrate why we need to check
> CLASSTYPE_IMPLICIT_INSTANTIATION instead of CLASSTYPE_TEMPLATE_INFO.
> I'd name this test concepts-friend18a.C to convey that it's a slight
> variant of the main test.
>
> While we're at it let's replace 'f' with the simpler:
>
>   int main() {
>     Hasher h;
>     add(h, 0);
>   }
Ok. I'll submit a v3 later.

Reply via email to