===================================================================
@@ -1221,9 +1221,9 @@ enum languages { lang_c, lang_cplusplus,
/* Gives the visibility specification for a class type. */
#define CLASSTYPE_VISIBILITY(TYPE) \
- DECL_VISIBILITY (TYPE_NAME (TYPE))
+ DECL_VISIBILITY (TYPE_MAIN_DECL (TYPE))
#define CLASSTYPE_VISIBILITY_SPECIFIED(TYPE) \
- DECL_VISIBILITY_SPECIFIED (TYPE_NAME (TYPE))
+ DECL_VISIBILITY_SPECIFIED (TYPE_MAIN_DECL (TYPE))
typedef struct GTY (()) tree_pair_s {
tree purpose;
===================================================================
@@ -2073,7 +2073,8 @@ determine_visibility (tree decl)
tree underlying_type = TREE_TYPE (DECL_NAME (decl));
int underlying_vis = type_visibility (underlying_type);
if (underlying_vis == VISIBILITY_ANON
- || CLASSTYPE_VISIBILITY_SPECIFIED (underlying_type))
+ || (CLASS_TYPE_P (underlying_type)
+ && CLASSTYPE_VISIBILITY_SPECIFIED (underlying_type)))
constrain_visibility (decl, underlying_vis);
else
DECL_VISIBILITY (decl) = VISIBILITY_DEFAULT;
===================================================================
@@ -0,0 +1,15 @@
+// { dg-do compile }
+// { dg-options "-fvisibility-ms-compat" }
+#include <typeinfo>
+
+template < typename T > void
+bar ()
+{
+ typeid (T);
+}
+
+void
+foo ()
+{
+ bar < int () > ();
+}
===================================================================
@@ -5799,8 +5799,9 @@ default_assemble_visibility (tree decl A
assemble_name (asm_out_file, name);
fprintf (asm_out_file, "\n");
#else
- warning (OPT_Wattributes, "visibility attribute not supported "
- "in this configuration; ignored");
+ if (decl && lookup_attribute ("visibility", DECL_ATTRIBUTES (decl)))
+ warning (OPT_Wattributes, "visibility attribute not supported "
+ "in this configuration; ignored");
#endif
}