When setting up the hidden namespace-scope decl for a local extern, we also
need to set its visibility.
PR c++/103291
gcc/cp/ChangeLog:
* name-lookup.cc (push_local_extern_decl_alias): Call
determine_visibility.
gcc/testsuite/ChangeLog:
* g++.dg/ext/visibility/visibility-local-extern1.C: New test.
&& CP_DECL_THREAD_LOCAL_P (decl)
&& alias != error_mark_node)
set_decl_tls_model (alias, DECL_TLS_MODEL (decl));
+
+ /* Adjust visibility. */
+ determine_visibility (alias);
}
}
--- /dev/null
+// PR c++/103291
+// { dg-additional-options -fpic }
+// { dg-final { scan-assembler-not "@GOTPCREL" } }
+
+#pragma GCC visibility push(hidden)
+
+int hidden_fetch(void) {
+ extern const int hidden_global;
+ return hidden_global;
+}