gcc/testsuite/g++.dg/cpp2a/concepts-friend13.C
raw| 1 | // Verify we substitute the correct outer template arguments |
| 2 | // when instantiating a constrained template friend declared |
| 3 | // inside a partial specialization. |
| 4 | // { dg-do compile { target c++20 } } |
| 5 | |
| 6 | template<class U> |
| 7 | requires __is_same(int*, U) |
| 8 | void f() { }; |
| 9 | |
| 10 | template<class T> |
| 11 | struct A; |
| 12 | |
| 13 | template<class T> |
| 14 | struct A<T*> { |
| 15 | template<class U> |
| 16 | requires __is_same(T, U) |
| 17 | friend void f() { } // { dg-bogus "redefinition" } |
| 18 | }; |
| 19 | |
| 20 | template struct A<int*>; |