aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c10
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/friend33.C12
4 files changed, 32 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index ee0f56e..2d6e1af0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index a73f691..07cdd5d 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -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)
{
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 555353a..b966939 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..f1b5cb2
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/friend33.C
@@ -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();
+};