Debian Codegraph @

gcc/testsuite/g++.dg/ext/visibility/ref-temp1.C

raw
1 // PR c++/91476
2 // Test that hidden and internal visibility propagates to reference temps.
3 // { dg-require-visibility "" }
4
5 #define HIDDEN __attribute((visibility("hidden")))
6
7 // { dg-final { scan-hidden "_ZGRZ1fvE3foo_" } }
8 HIDDEN inline const int* f() { static const int &foo = 1; return &foo; }
9
10 // { dg-final { scan-assembler-not "(weak|globl)\[^\n\]*_ZGRN12_GLOBAL__N_13fooE_" } }
11 namespace { const int &foo = 1; }
12
13 const void *volatile p;
14 int main()
15 {
16 p = f();
17 p = &foo;
18 }