decl.c (start_decl): An explicit specialization of a static data member is only a...
authorJason Merrill <jason@yorick.cygnus.com>
Wed, 25 Nov 1998 01:59:30 +0000 (01:59 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 25 Nov 1998 01:59:30 +0000 (20:59 -0500)
* decl.c (start_decl): An explicit specialization of a static data
member is only a definition if it has an initializer.

From-SVN: r23847

gcc/cp/ChangeLog
gcc/cp/decl.c

index 0861bb4c31b26295d2887c29e681e241c7616e47..94d8d3a8ff481e8eedad79ddbf2195efca8ec150 100644 (file)
@@ -1,5 +1,8 @@
 1998-11-24  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * decl.c (start_decl): An explicit specialization of a static data
+       member is only a definition if it has an initializer.
+
        * except.c (expand_throw): Use cp_finish_decl for the throw temp.
        * cvt.c (build_up_reference): Pass DIRECT_BIND down into
        cp_finish_decl.
index b21a7a9015627b9af8b30bfd06fe57a5798fb943..94173636b281ad60cf7a42b4040da4ca80ca1e13 100644 (file)
@@ -6770,7 +6770,17 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
       DECL_IN_AGGR_P (decl) = 0;
       if ((DECL_LANG_SPECIFIC (decl) && DECL_USE_TEMPLATE (decl)) 
          || CLASSTYPE_USE_TEMPLATE (context))
-       SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+       {
+         SET_DECL_TEMPLATE_SPECIALIZATION (decl);
+         /* [temp.expl.spec] An explicit specialization of a static data
+            member of a template is a definition if the declaration
+            includes an initializer; otherwise, it is a declaration.
+
+            We check for processing_specialization so this only applies
+            to the new specialization syntax.  */
+         if (DECL_INITIAL (decl) == NULL_TREE && processing_specialization)
+           DECL_EXTERNAL (decl) = 1;
+       }
 
       if (DECL_EXTERNAL (decl) && ! DECL_TEMPLATE_SPECIALIZATION (decl))
        cp_pedwarn ("declaration of `%#D' outside of class is not definition",