Debian Codegraph @

gcc/testsuite/g++.dg/template/attr-used.C

raw
1 // { dg-do compile }
2
3 template<typename T> struct X {
4 void g () {}
5 void f () __attribute__((__used__)) {}
6 };
7
8 extern X<int> x; // X<int> incomplete here
9
10 template <typename T>
11 void Frob (T t) {
12 x.g(); // X<int> completed here, X<int>::f's body marked for instantiation
13 }
14
15 // Make sure X<int>::f is emitted
16 // { dg-final { scan-assembler "_ZN1XIiE1fEv:" } }