* call.c (make_temporary_var_for_ref_to_temp): Clear TREE_PUBLIC
if DECL is in the anonymous namespace.
+2020-01-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/91476 - anon-namespace reference temp clash between TUs.
+ * call.c (make_temporary_var_for_ref_to_temp): Clear TREE_PUBLIC
+ if DECL is in the anonymous namespace.
+
2020-01-17 Jason Merrill <jason@redhat.com>
PR c++/92531 - ICE with noexcept(lambda).
TREE_STATIC (var) = TREE_STATIC (decl);
TREE_PUBLIC (var) = TREE_PUBLIC (decl);
+ if (decl_anon_ns_mem_p (decl))
+ TREE_PUBLIC (var) = 0;
if (vague_linkage_p (decl))
comdat_linkage (var);
--- /dev/null
+// PR c++/91476
+// Test that hidden and internal visibility propagates to reference temps.
+
+// { dg-final { scan-assembler-not "(weak|globl)\[^\n\]*_ZGRN12_GLOBAL__N_13fooE_" } }
+namespace { const int &foo = 1; }
+
+const void *volatile p;
+int main()
+{
+ p = &foo;
+}