aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1997-11-28 05:30:44 -0500
committerJason Merrill <jason@gcc.gnu.org>1997-11-28 05:30:44 -0500
commit74cd8397f8eb4bc84944c7ccb1b8883d31655976 (patch)
treee9b9014de908dd14b658cdeee6cb4f339ef09d5c
parent6a0d3671ed17ad3114170c5d79e1ca75c68946d1 (diff)
downloadgcc-74cd8397f8eb4bc84944c7ccb1b8883d31655976.zip
gcc-74cd8397f8eb4bc84944c7ccb1b8883d31655976.tar.gz
gcc-74cd8397f8eb4bc84944c7ccb1b8883d31655976.tar.bz2
pt.c (check_explicit_specialization): Complain about using a template-id for a non-specialization.
* pt.c (check_explicit_specialization): Complain about using a template-id for a non-specialization. Fri Nov 28 01:56:35 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de> * error.c (dump_decl): Handle TEMPLATE_ID_EXPR. From-SVN: r16818
-rw-r--r--gcc/cp/ChangeLog9
-rw-r--r--gcc/cp/error.c18
-rw-r--r--gcc/cp/pt.c11
3 files changed, 36 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 0b1b931..7ceb75a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,12 @@
+Fri Nov 28 01:58:14 1997 Jason Merrill <jason@yorick.cygnus.com>
+
+ * pt.c (check_explicit_specialization): Complain about using a
+ template-id for a non-specialization.
+
+Fri Nov 28 01:56:35 1997 Bruno Haible <bruno@linuix.mathematik.uni-karlsruhe.de>
+
+ * error.c (dump_decl): Handle TEMPLATE_ID_EXPR.
+
Thu Nov 27 00:59:46 1997 Jason Merrill <jason@yorick.cygnus.com>
* typeck.c (build_const_cast): Handle references here instead of
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 5042126..ccc5b46 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -776,6 +776,24 @@ dump_decl (t, v)
}
break;
+ case TEMPLATE_ID_EXPR:
+ {
+ tree args;
+ dump_type (TREE_OPERAND (t, 0), v);
+ OB_PUTC ('<');
+ for (args = TREE_OPERAND (t, 1); args; args = TREE_CHAIN (args))
+ {
+ if (TREE_CODE_CLASS (TREE_CODE (TREE_VALUE (args))) == 't')
+ dump_type (TREE_VALUE (args), 0);
+ else
+ dump_expr (TREE_VALUE (args), 0);
+ if (TREE_CHAIN (args))
+ OB_PUTC2 (',', ' ');
+ }
+ OB_PUTC ('>');
+ }
+ break;
+
case LABEL_DECL:
OB_PUTID (DECL_NAME (t));
break;
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3b56dac..1e9c905 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -496,12 +496,19 @@ check_explicit_specialization (declarator, decl, template_count, flags)
&& !processing_explicit_specialization (template_count)
&& !is_friend)
{
- if (!have_def)
+ if (!have_def && ! template_header_count)
/* This is not an explicit specialization. It must be
an explicit instantiation. */
return 2;
+ else if (template_header_count > template_count
+ && !processing_specialization)
+ {
+ cp_error ("template-id `%D' in declaration of primary template",
+ declarator);
+ return 0;
+ }
else if (pedantic)
- pedwarn ("Explicit specialization not preceeded by `template <>'");
+ pedwarn ("explicit specialization not preceeded by `template <>'");
}
if (TREE_CODE (declarator) != TEMPLATE_ID_EXPR)