[Bug c++/17037] static map in template crash on runtime when inserting

bangerth at dealii dot org gcc-bugzilla@gcc.gnu.org
Sun Aug 15 19:59:00 GMT 2004


------- Additional Comments From bangerth at dealii dot org  2004-08-15 19:59 -------
The code is invalid in a number of ways about which the compiler 
can't do much. First, with this line: 
  template <> f<char>::mapType f<char>::months; 
This declares the _existence_ of a specialization. It does not 
_define_ it. 
 
The second bug is that you declare the specialization _after_ explicit 
instantiation of the class. The standard doesn't allow it. Since you 
do so, the compiler also can't warn you that that symbol doesn't exist, 
since it already instantiated it.  
 
For both these cases, no diagnostics are required. 
 
If you fix your code, the program runs just fine. 
 
W. 

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


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



More information about the Gcc-bugs mailing list