Clang Project

clang_source_code/test/SemaCXX/friend-template-redecl.cpp
1// RUN: %clang_cc1 -std=c++17 -verify -emit-llvm-only %s
2
3// expected-no-diagnostics
4
5template <class T> void bar(const T &t) { foo(t); }
6
7template <class>
8struct HasFriend {
9  template <class T>
10  friend void foo(const HasFriend<T> &m) noexcept(false);
11};
12
13template <class T>
14void foo(const HasFriend<T> &m) noexcept(false) {}
15
16void f() {
17  HasFriend<int> x;
18  foo(x);
19  bar(x);
20}
21