Commit 7e2421f7 by Mark Mitchell Committed by Mark Mitchell

decl.c (grokfndecl): Issue error on declaration of friend templates with…

decl.c (grokfndecl): Issue error on declaration of friend templates with explicit template arguments.

	* decl.c (grokfndecl): Issue error on declaration of friend
	templates with explicit template arguments.

From-SVN: r22100
parent 8b5b8b7c
1998-08-30 Mark Mitchell <mark@markmitchell.com>
* decl.c (grokfndecl): Issue error on declaration of friend
templates with explicit template arguments.
* pt.c (convert_template_argument): New function, split out
from...
(coerce_template_parms): Here.
......
......@@ -7968,6 +7968,14 @@ grokfndecl (ctype, type, declarator, orig_declarator, virtualp, flags, quals,
orig_declarator);
else
{
if (PROCESSING_REAL_TEMPLATE_DECL_P ())
{
/* Something like `template <class T> friend void f<T>()'. */
cp_error ("template-id `%D' in declaration of primary template",
orig_declarator);
return error_mark_node;
}
/* A friend declaration of the form friend void f<>(). Record
the information in the TEMPLATE_ID_EXPR. */
SET_DECL_IMPLICIT_INSTANTIATION (decl);
......
// Build don't link:
template <class A, class B> void foo();
template <class C> class bar {
int i;
template <class B> friend void foo<C,B>(); // ERROR - template-id
};
template <class A, class B> void foo() {
bar<A> baz; baz.i = 1;
bar<int> buz; buz.i = 1;
}
int main() {
foo<void,void>();
foo<int,void>();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment