Debian Codegraph @

gcc/testsuite/g++.dg/abi/anon4.C

raw
1 // PR c++/65209
2 // { dg-additional-options "-fno-pie" { target { ia32 || sparc*-*-* } } }
3 // { dg-final { scan-assembler-not "comdat" } }
4
5 // Everything involving the anonymous namespace bits should be private, not
6 // COMDAT.
7
8 struct Bar
9 {
10 static Bar *self();
11 char pad[24];
12 };
13
14 template <Bar *(&holderFunction)()>
15 struct BarGlobalStatic
16 {
17 Bar *operator()() { return holderFunction(); }
18 };
19
20 namespace {
21 namespace Q_QGS_s_self {
22 inline Bar *innerFunction() {
23 static struct Holder {
24 Bar value;
25 ~Holder() {}
26 } holder;
27 return &holder.value;
28 }
29 }
30 }
31 static BarGlobalStatic<Q_QGS_s_self::innerFunction> s_self;
32
33 Bar *Bar::self()
34 {
35 return s_self();
36 }
37
38 int main(int argc, char *argv[])
39 {
40 Bar* bar = Bar::self();
41 return 0;
42 }