+2005-09-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/22147
+ * name-lookup.c (maybe_process_template_type_declaration): Don't
+ treat forward declarations of classes as templates just because
+ we're processing_template_decl.
+ * pt.c (tsubst_decl): Clear DECL_TEMPLATE_INFO for friend
+ functions.
+
2005-09-26 Jason Merrill <jason@redhat.com>
PR c++/13764
is a forward-declaration of `A'. */
;
+ else if (b->kind == sk_namespace
+ && current_binding_level->kind != sk_namespace)
+ /* If this new type is being injected into a containing scope,
+ then it's not a template type. */
+ ;
else
{
gcc_assert (IS_AGGR_TYPE (type) || TREE_CODE (type) == ENUMERAL_TYPE);
&& !uses_template_parms (argvec))
tsubst_default_arguments (r);
}
+ else
+ DECL_TEMPLATE_INFO (r) = NULL_TREE;
/* Copy the list of befriending classes. */
for (friends = &DECL_BEFRIENDING_CLASSES (r);
+2005-09-27 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/22147
+ * g++.dg/template/friend37.C: New test.
+ * g++.dg/parse/crash28.C: Adjust error markers.
+
2005-09-27 Jakub Jelinek <jakub@redhat.com>
PR fortran/18518
// Volker Reichelt <reichelt@gcc.gnu.org>
template <class _Tp> class insert_iterator<slist<_Tp> > {}; // { dg-error "not a template|not declared in this scope|expected unqualified-id|extra" }
-template <class _Value> class insert_iterator<int > { // { dg-error "template parameters not used|_Value" }
+template <class _Value> class insert_iterator<int > { // { dg-error "template" }
hash_set<_Value>; // { dg-error "no type|expected" }
};
template<int> struct A<X<> > {}; // { dg-error "not a template|not declared in this scope|expected unqualified-id|extra" }
-struct A {}; // { dg-error "template argument required" }
+struct A {};
--- /dev/null
+// PR c++/22147
+
+template<typename> struct A;
+
+template<typename T> void foo(A<T>* p) { *p; }
+
+template<typename> struct A
+{
+ friend void foo<class X>(A<X>*);
+};
+
+void bar()
+{
+ foo<int>(0);
+}