diff gcc/testsuite/g++.dg/ext/visibility/ref-temp1.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gcc/testsuite/g++.dg/ext/visibility/ref-temp1.C	Thu Feb 13 11:34:05 2020 +0900
@@ -0,0 +1,17 @@
+// PR c++/91476
+// Test that hidden and internal visibility propagates to reference temps.
+
+#define HIDDEN __attribute((visibility("hidden")))
+
+// { dg-final { scan-hidden "_ZGRZ1fvE3foo_" } }
+HIDDEN inline const int* f() { static const int &foo = 1; return &foo; }
+
+// { dg-final { scan-assembler-not "(weak|globl)\[^\n\]*_ZGRN12_GLOBAL__N_13fooE_" } }
+namespace { const int &foo = 1; }
+
+const void *volatile p;
+int main()
+{
+  p = f();
+  p = &foo;
+}