re PR c++/18733 (friend rejected)
authorGiovanni Bajo <giovannibajo@gcc.gnu.org>
Thu, 23 Dec 2004 01:49:39 +0000 (01:49 +0000)
committerGiovanni Bajo <giovannibajo@gcc.gnu.org>
Thu, 23 Dec 2004 01:49:39 +0000 (01:49 +0000)
PR c++/18733
* pt.c (check_explicit_specialization): Use special logic to validate
befriended specializations.

PR c++/18733
* g++.dg/template/friend33.C: New testcase.

From-SVN: r92527

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/friend33.C [new file with mode: 0644]

index ee0f56e3a3649197630944a59ab24ad8456fee0f..2d6e1af0133550b41b38881d19da73d37fc30c0e 100644 (file)
@@ -1,3 +1,9 @@
+2004-12-23  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/18733
+       * pt.c (check_explicit_specialization): Use special logic to validate
+       befriended specializations.
+
 2004-12-22  Mark Mitchell  <mark@codesourcery.com>
 
        * rtti.c (emit_support_tinfos): Avoid using C99 semantics.
index a73f6916f02fd6a694ba3f461d18d9b4ab4568c0..07cdd5d7356021cbcdd7ef7eee367304f132b118 100644 (file)
@@ -1738,7 +1738,15 @@ check_explicit_specialization (tree declarator,
   tree dname = DECL_NAME (decl);
   tmpl_spec_kind tsk;
 
-  tsk = current_tmpl_spec_kind (template_count);
+  if (is_friend)
+    {
+      if (!processing_specialization)
+       tsk = tsk_none;
+      else
+       tsk = tsk_excessive_parms;
+    }
+  else
+    tsk = current_tmpl_spec_kind (template_count);
 
   switch (tsk)
     {
index 555353a2d567615f230f6b647461dcf34e88886e..b966939c2ac1498ed68cb9ccc8b8f0b16bf95221 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-23  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+
+       PR c++/18733
+       * g++.dg/template/friend33.C: New testcase.
+
 2004-12-22  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/18464
diff --git a/gcc/testsuite/g++.dg/template/friend33.C b/gcc/testsuite/g++.dg/template/friend33.C
new file mode 100644 (file)
index 0000000..f1b5cb2
--- /dev/null
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// PR c++/18733: Validation of template headers in friends
+
+template<int> struct A
+{
+  void foo();
+};
+
+struct B
+{
+  friend void A<0>::foo();
+};