decl.c (grokdeclarator): Count partial specializations when keeping track of how...
authorMark Mitchell <mark@codesourcery.com>
Sun, 26 Mar 2000 03:05:49 +0000 (03:05 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 26 Mar 2000 03:05:49 +0000 (03:05 +0000)
* 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
gcc/cp/decl.c
gcc/cp/dump.c

index 63add6d3a7a2592ce21beb9adf036341b9167f79..58c03238b3b4e7b07f581d548fbc5513580291fa 100644 (file)
@@ -1,3 +1,10 @@
+2000-03-25  Mark Mitchell  <mark@codesourcery.com>
+
+       * 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  <kenner@vlsi1.ultra.nyu.edu>
 
        * class.c (build_vbase_pointer_fields): layout_field now place_field.
index ff2cf407dac451deb6dfee6922e9b539e47dfbd5..2a2ca1596a502b99d09312093afe3a9add215824 100644 (file)
@@ -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 <class T> struct S{};
+                    template <> struct S<int> { void f(); };
+                    void S<int>::f () {}
+
+                  is correct; there shouldn't be a `template <>' for
+                  the definition of `S<int>::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);
index d66f21770e980a831c9531fa084bc9bf929cd423..fe43fb0ffd1df41bdc32b113a9851b97fd464155 100644 (file)
@@ -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;