From da8a74562581602cb37afdc47dc1a5ef98c57893 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 26 Mar 2000 03:05:49 +0000 Subject: [PATCH] decl.c (grokdeclarator): Count partial specializations when keeping track of how many template classes... * decl.c (grokdeclarator): Count partial specializations when keeping track of how many template classes have been seen. * dump.c (dequeue_and_dump): Dump DECL_TEMPLATE_RESULT. From-SVN: r32743 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/decl.c | 16 ++++++++++++++-- gcc/cp/dump.c | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 63add6d3a7a..58c03238b3b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2000-03-25 Mark Mitchell + + * decl.c (grokdeclarator): Count partial specializations when + keeping track of how many template classes have been seen. + + * dump.c (dequeue_and_dump): Dump DECL_TEMPLATE_RESULT. + Sat Mar 25 09:12:10 2000 Richard Kenner * class.c (build_vbase_pointer_fields): layout_field now place_field. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ff2cf407dac..2a2ca1596a5 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -10647,9 +10647,21 @@ grokdeclarator (declarator, declspecs, decl_context, initialized, attrlist) t = ctype; while (t != NULL_TREE && CLASS_TYPE_P (t)) { - if (CLASSTYPE_TEMPLATE_INFO (t) && - !CLASSTYPE_TEMPLATE_SPECIALIZATION (t)) + /* You're supposed to have one `template <...>' + for every template class, but you don't need one + for a full specialization. For example: + + template struct S{}; + template <> struct S { void f(); }; + void S::f () {} + + is correct; there shouldn't be a `template <>' for + the definition of `S::f'. */ + if (CLASSTYPE_TEMPLATE_INFO (t) + && (CLASSTYPE_TEMPLATE_INSTANTIATION (t) + || uses_template_parms (CLASSTYPE_TI_ARGS (t)))) template_count += 1; + t = TYPE_MAIN_DECL (t); if (DECL_LANG_SPECIFIC (t)) t = DECL_CONTEXT (t); diff --git a/gcc/cp/dump.c b/gcc/cp/dump.c index d66f21770e9..fe43fb0ffd1 100644 --- a/gcc/cp/dump.c +++ b/gcc/cp/dump.c @@ -609,6 +609,7 @@ dequeue_and_dump (di) break; case TEMPLATE_DECL: + dump_child ("rslt", DECL_TEMPLATE_RESULT (t)); dump_child ("inst", DECL_TEMPLATE_INSTANTIATIONS (t)); dump_child ("spcs", DECL_TEMPLATE_SPECIALIZATIONS (t)); break; -- 2.30.2