/* RunTime Type Identification
Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007
+ 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
Mostly written by Jason Merrill (jason@cygnus.com).
#include "toplev.h"
#include "convert.h"
#include "target.h"
+#include "c-pragma.h"
/* C++ returns type information to the user in struct type_info
objects. We also use type information to implement dynamic_cast and
static int doing_runtime = 0;
\f
+static void
+push_abi_namespace (void)
+{
+ push_nested_namespace (abi_node);
+ push_visibility ("default");
+}
+
+static void
+pop_abi_namespace (void)
+{
+ pop_visibility ();
+ pop_nested_namespace (abi_node);
+}
/* Declare language defined type_info type and a pointer to const
type_info. This is incomplete here, and will be completed when
{
tree tmp;
tree tinfo_ptr;
- tree ns = abi_node;
const char *name;
- push_nested_namespace (ns);
+ push_abi_namespace ();
tinfo_ptr = xref_tag (class_type,
get_identifier ("__class_type_info"),
/*tag_scope=*/ts_current, false);
tmp = build_function_type (ptr_type_node, tmp);
dcast_fn = build_library_fn_ptr (name, tmp);
DECL_IS_PURE (dcast_fn) = 1;
- pop_nested_namespace (ns);
+ pop_abi_namespace ();
dynamic_cast_node = dcast_fn;
}
result = build_cxx_call (dcast_fn, 4, elems);
if (!vtable_ptr)
{
tree real_type;
- push_nested_namespace (abi_node);
+ push_abi_namespace ();
real_type = xref_tag (class_type, ti->name,
/*tag_scope=*/ts_current, false);
- pop_nested_namespace (abi_node);
+ pop_abi_namespace ();
if (!COMPLETE_TYPE_P (real_type))
{
TK_BASE_TYPE)->type,
array_domain);
- push_nested_namespace (abi_node);
+ push_abi_namespace ();
create_pseudo_type_info
(ix, "__vmi_class_type_info",
build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
build_decl (FIELD_DECL, NULL_TREE, integer_type_node),
build_decl (FIELD_DECL, NULL_TREE, base_array),
NULL);
- pop_nested_namespace (abi_node);
+ pop_abi_namespace ();
break;
}
}
VEC_safe_grow (tinfo_s, gc, tinfo_descs, TK_FIXED);
- push_nested_namespace (abi_node);
+ push_abi_namespace ();
/* Create the internal type_info structure. This is used as a base for
the other structures. */
build_decl (FIELD_DECL, NULL_TREE, type_info_ptr_type),
NULL);
- pop_nested_namespace (abi_node);
+ pop_abi_namespace ();
}
/* Emit the type_info descriptors which are guaranteed to be in the runtime
int ix;
tree bltn_type, dtor;
- push_nested_namespace (abi_node);
+ push_abi_namespace ();
bltn_type = xref_tag (class_type,
get_identifier ("__fundamental_type_info"),
/*tag_scope=*/ts_current, false);
- pop_nested_namespace (abi_node);
+ pop_abi_namespace ();
if (!COMPLETE_TYPE_P (bltn_type))
return;
dtor = CLASSTYPE_DESTRUCTORS (bltn_type);
--- /dev/null
+// PR c++/35368
+// { dg-require-visibility "" }
+
+#pragma GCC visibility push (hidden)
+
+#include <typeinfo>
+
+const std::type_info& info1 = typeid(int []);
+const std::type_info& info2 = typeid(int);
+enum E { e = 0 };
+const std::type_info& info3 = typeid(E);
+struct S { S (); };
+const std::type_info& info4 = typeid(S);
+const std::type_info& info5 = typeid(int *);
+
+// { dg-final { scan-not-hidden "_ZTVN10__cxxabiv117__array_type_infoE" } }
+// { dg-final { scan-not-hidden "_ZTVN10__cxxabiv116__enum_type_infoE" } }
+// { dg-final { scan-hidden "_ZTI1S" } }
+// { dg-final { scan-hidden "_ZTS1S" } }
+// { dg-final { scan-hidden "info1" } }
+// { dg-final { scan-hidden "info2" } }
+// { dg-final { scan-hidden "info3" } }
+// { dg-final { scan-hidden "info4" } }
+// { dg-final { scan-hidden "info5" } }