1 // { dg-additional-options "-fmodules-ts -fdump-lang-module-graph-blocks" }
2 // declarations followed by friend injection
3 
4 export module foo;
5 // { dg-module-cmi foo }
6 
7 void foo (int, void *);
8 void foo (float, void *);
9 
10 template <typename T> class TPL
11 {
12   friend void foo (T, void *); // { dg-warning "non-template function" }
13 
14   T member;
15 };
16 
17 template class TPL<float>;  // instantiate
18 
19 // binding->465500
20 // FUNCTION_DECL->465500
21 //   DECL_TEMPLATE_INFO->NULL
22 //   DECL_USE_TEMPLATE->0
23 
24 // specialization 465500
25 // tmpl->333580 template_decl
26 //  the friend decl implicit template
27 
28 // args->46b640 tree_vec
29 //   length:1
30 //   elt:0 real_type
31 
32 // do not add this (non-)specialization to the depset table
33 // the ::foo fns and TPL should be in different depsets
34 // the friend decl should be streamed as part of TPL's definition
35 
36 // { dg-final { scan-lang-dump-not {Connecting declaration decl template_decl:'::foo'} module } }
37 
38 // { dg-final { scan-lang-dump {Cluster members:\n  \[0\]=decl declaration '::foo'\n  \[1\]=decl declaration '::foo'\n  \[2\]=binding '::foo'} module } }
39 // { dg-final { scan-lang-dump {Cluster members:\n  \[0\]=decl definition '::template TPL'\n(  \[.\]=[^\n]*'\n)*  \[.\]=binding '::TPL'} module } }
40 // { dg-final { scan-lang-dump {Cluster members:\n  \[0\]=specialization definition '::TPL<float>'} module } }
41