templates with explicit template arguments.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@22100
138bc75d-0d04-0410-961f-
82ee72b054a4
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.
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);
--- /dev/null
+// 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>();
+}