| 1 |
// RUN: %clang_cc1 -std=c++17 -verify -emit-llvm-only %s |
| 2 |
|
| 3 |
template <class T> void bar(const T &t) { foo(t); } |
| 4 |
|
| 5 |
template <class> |
| 6 |
struct HasFriend { |
| 7 |
template <class T> |
| 8 |
friend void foo(const HasFriend<T> &m) noexcept(false); |
| 9 |
}; |
| 10 |
|
| 11 |
template <class T> |
| 12 |
void foo(const HasFriend<T> &m) noexcept(false) {} |
| 13 |
|
| 14 |
void f() { |
| 15 |
HasFriend<int> x; |
| 16 |
foo(x); |
| 17 |
bar(x); |
| 18 |
} |
| 19 |
|
| 20 |
template<typename T> void droid(); |
| 21 |
struct X { |
| 22 |
template<typename T> friend void ::droid(); |
| 23 |
template<int N> friend void ::droid(); // expected-error {{does not match}} |
| 24 |
// FIXME: We should produce a note for the above candidate explaining why |
| 25 |
// it's not the droid we're looking for. |
| 26 |
}; |