summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/friend-template-redecl.cpp
blob: 4ee03c6f6387f7415c89f14f217a0d6a25b8ea72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// RUN: %clang_cc1 -std=c++17 -verify -emit-llvm-only %s

template <class T> void bar(const T &t) { foo(t); }

template <class>
struct HasFriend {
  template <class T>
  friend void foo(const HasFriend<T> &m) noexcept(false);
};

template <class T>
void foo(const HasFriend<T> &m) noexcept(false) {}

void f() {
  HasFriend<int> x;
  foo(x);
  bar(x);
}

template<typename T> void droid();
struct X {
  template<typename T> friend void ::droid();
  template<int N> friend void ::droid(); // expected-error {{does not match}}
  // FIXME: We should produce a note for the above candidate explaining why
  // it's not the droid we're looking for.
};