1 // This tests for [basic.lookup.argdep]/p4.2:
2 //   Argument-dependent lookup finds all declarations of functions and function templates that
3 // - ...
4 // - are declared as a friend ([class.friend]) of any class with a reachable definition in the set of associated entities,
5 //
6 // RUN: rm -fr %t
7 // RUN: mkdir %t
8 // RUN: split-file %s %t
9 //
10 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/Friend-in-reachable-class.cppm -o %t/X.pcm
11 // RUN: %clang_cc1 -std=c++20 -fprebuilt-module-path=%t %t/Use.cpp -verify -fsyntax-only
12 //
13 //--- Friend-in-reachable-class.cppm
14 module;
15 # 3 __FILE__ 1
16 struct A {
17   friend int operator+(const A &lhs, const A &rhs) {
18     return 0;
19   }
20 };
21 # 6 "" 2
22 export module X;
23 export using ::A;
24 
25 //--- Use.cpp
26 // expected-no-diagnostics
27 import X;
28 int use() {
29   A a, b;
30   return a + b;
31 }
32