+2013-03-20 Jason Merrill <jason@redhat.com>
+
+ PR c++/17232
+ PR c++/56642
+ * pt.c (tsubst_decl): Check return value of register_specialization.
+ * typeck2.c (abstract_virtuals_error_sfinae): Re-apply complete_type
+ change.
+
2013-03-17 Jason Merrill <jason@redhat.com>
PR c++/54359
DECL_TEMPLATE_INFO (r)
= build_template_info (gen_tmpl, argvec);
SET_DECL_IMPLICIT_INSTANTIATION (r);
- register_specialization (r, gen_tmpl, argvec, false, hash);
+
+ tree new_r
+ = register_specialization (r, gen_tmpl, argvec, false, hash);
+ if (new_r != r)
+ /* We instantiated this while substituting into
+ the type earlier (template/friend54.C). */
+ RETURN (new_r);
/* We're not supposed to instantiate default arguments
until they are called, for a template. But, for a
return 0;
type = TYPE_MAIN_VARIANT (type);
+ /* In SFINAE context, force instantiation. */
+ if (!(complain & tf_error))
+ complete_type (type);
+
/* If the type is incomplete, we register it within a hash table,
so that we can check again once it is completed. This makes sense
only for objects for which we have a declaration or at least a
};
template<typename T>
-void g(T (*a)[1]) {} // { dg-error "abstract" "" { xfail *-*-* } }
+void g(T (*a)[1]) {} // { dg-error "abstract" "" }
int main() {
- g<A<int> >(0); // { dg-error "no matching function" "" { xfail *-*-* } }
+ g<A<int> >(0); // { dg-error "no matching function" }
}
--- /dev/null
+// PR c++/56642
+
+template <class T> struct A;
+
+template <class T>
+A<T> f(T*) { return A<T>(); }
+
+template <class T>
+struct A
+{
+ friend A f<T>(T*);
+};
+
+int main()
+{
+ int *p = 0;
+ f(p);
+}