[Bug c++/20133] [4.0/4.1 Regression] internal compiler error: in import_export_decl, at cp/decl2.c:1726

reichelt at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 11 16:25:00 GMT 2005


------- Additional Comments From reichelt at gcc dot gnu dot org  2005-07-11 16:15 -------
It doesn't link because of [templ.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.  [Note: there is no syntax for the definition of a
   static data member of a template that requires default initialization.
   template<> X Q<int>::x;
   This  is a declaration regardless of whether X can be default initial-
   ized (_dcl.init_).  ]

You must provide the initializer, e.g.

template<> int ObjectPool<char>::mutex = 0;



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |reichelt at gcc dot gnu dot
                   |                            |org
           Keywords|                            |monitored


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20133



More information about the Gcc-bugs mailing list