+2016-08-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/57728
+ * pt.c (do_type_instantiation): Don't mess with non-user-provided
+ member functions.
+
2016-08-25 Marek Polacek <polacek@redhat.com>
* parser.c (cp_parser_binary_expression): Pass LHS to
}
/* Returns true iff FN is a user-provided function, i.e. user-declared
- and not defaulted at its first declaration; or explicit, private,
- protected, or non-const. */
+ and not defaulted at its first declaration. */
bool
user_provided_p (tree fn)
if (! static_p)
for (tmp = TYPE_METHODS (t); tmp; tmp = DECL_CHAIN (tmp))
if (TREE_CODE (tmp) == FUNCTION_DECL
- && DECL_TEMPLATE_INSTANTIATION (tmp))
+ && DECL_TEMPLATE_INSTANTIATION (tmp)
+ && user_provided_p (tmp))
instantiate_class_member (tmp, extern_p);
for (tmp = TYPE_FIELDS (t); tmp; tmp = DECL_CHAIN (tmp))
--- /dev/null
+// Test that we treat defaulted-in-class members like implicitly declared
+// members for explicit instantiation.
+
+// { dg-do compile { target c++11 } }
+
+template<typename T>
+struct A
+{
+ T x;
+ A() = default;
+ A(const A &other) = default;
+ A& operator=(const A&) = default;
+};
+
+template class A<int>;
+
+// { dg-final { scan-assembler-not "_ZN1AIiEC1Ev" } }
+// { dg-final { scan-assembler-not "_ZN1AIiEC1ERKS0_" } }
+// { dg-final { scan-assembler-not "_ZN1AIiEaSERKS0_" } }
--- /dev/null
+// PR c++/57728
+// { dg-do link { target c++11 } }
+
+template<typename T>
+struct A
+{
+ T x;
+ A() = default;
+ A(const A &other) = delete;
+};
+
+extern template class A<int>;
+
+int main()
+{
+ A<int> a;
+}