Debian Codegraph @

gcc/testsuite/g++.dg/modules/tpl-friend-16_a.C

raw
1 // PR c++/115801
2 // { dg-additional-options "-fmodules-ts -Wno-global-module" }
3 // { dg-module-cmi test }
4
5 module;
6
7 template <typename T> struct GMF;
8 template <typename T> struct GMF_Hidden {
9 int go() { GMF<T> gmf; return gmf.x; }
10 };
11
12 template <typename T> struct GMF {
13 private:
14 template <typename> friend struct ::GMF_Hidden;
15 int x = 1;
16 };
17
18 template <typename T> int test_gmf() {
19 GMF_Hidden<T> h; return h.go();
20 }
21
22 export module test;
23
24 export using ::GMF;
25 export using ::test_gmf;
26
27 export template <typename> struct Attached;
28 template <typename T> struct Attached_Hidden {
29 int go() { Attached<T> attached; return attached.x; }
30 };
31
32 template <typename T> struct Attached {
33 private:
34 template <typename> friend struct ::Attached_Hidden;
35 int x = 2;
36 };
37
38 export template <typename T> int test_attached() {
39 Attached_Hidden<T> h; return h.go();
40 }