+2014-09-15 Jason Merrill <jason@redhat.com>
+
+ * pt.c (lookup_template_class_1): Splice out abi_tag attribute if
+ necessary. Call inherit_targ_abi_tags here.
+ * class.c (check_bases_and_members): Not here.
+ (inherit_targ_abi_tags): Check CLASS_TYPE_P.
+ * cp-tree.h: Declare inherit_targ_abi_tags.
+
2014-09-15 Ville Voutilainen <ville.voutilainen@gmail.com>
Do not diagnose lambda default arguments in c++14 modes.
void
inherit_targ_abi_tags (tree t)
{
- if (CLASSTYPE_TEMPLATE_INFO (t) == NULL_TREE)
+ if (!CLASS_TYPE_P (t)
+ || CLASSTYPE_TEMPLATE_INFO (t) == NULL_TREE)
return;
mark_type_abi_tags (t, true);
bool saved_nontrivial_dtor;
tree fn;
- /* Pick up any abi_tags from our template arguments before checking. */
- inherit_targ_abi_tags (t);
-
/* By default, we use const reference arguments and generate default
constructors. */
cant_have_const_ctor = 0;
extern bool type_build_ctor_call (tree);
extern bool type_build_dtor_call (tree);
extern void explain_non_literal_class (tree);
+extern void inherit_targ_abi_tags (tree);
extern void defaulted_late_check (tree);
extern bool defaultable_fn_check (tree);
extern void fixup_type_variants (tree);
if (OVERLOAD_TYPE_P (t)
&& !DECL_ALIAS_TEMPLATE_P (gen_tmpl))
- if (tree attributes
- = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (template_type)))
- TYPE_ATTRIBUTES (t) = attributes;
+ {
+ if (tree attributes
+ = lookup_attribute ("abi_tag", TYPE_ATTRIBUTES (template_type)))
+ {
+ if (!TREE_CHAIN (attributes))
+ TYPE_ATTRIBUTES (t) = attributes;
+ else
+ TYPE_ATTRIBUTES (t)
+ = build_tree_list (TREE_PURPOSE (attributes),
+ TREE_VALUE (attributes));
+ }
+ }
/* Let's consider the explicit specialization of a member
of a class template specialization that is implicitly instantiated,
TREE_PUBLIC (type_decl) = 1;
determine_visibility (type_decl);
+ inherit_targ_abi_tags (t);
+
return t;
}
}
--- /dev/null
+#ifndef ABI_TAG
+#define ABI_TAG __attribute__((__abi_tag__("cxx11")))
+#endif
+
+typedef unsigned long size_t;
+
+template<typename C>
+struct char_traits { };
+template<typename C>
+struct allocator { };
+
+template<typename C, typename T = char_traits<C>, typename A = allocator<C> >
+struct ABI_TAG basic_string { };
+
+typedef basic_string<char> string;
+
+template<typename T>
+struct hash
+{
+ size_t
+ operator()(T val) const;
+};
+
+template<>
+size_t
+hash<string>::operator()(string) const { return 0; }
+
+// { dg-final { scan-assembler "_ZNK4hashI12basic_stringB5cxx11Ic11char_traitsIcE9allocatorIcEEEclES5_" } }