[Bug c++/19610] default constructor not called for static template member of template class
--- Additional Comments From bangerth at dealii dot org 2005-01-26 04:16 --- The declaration of a specialization is not a definition, unless it has an explicit initializer call. The way you want to write this is as follows: template Achar Bchar::a = Achar(); The standard specifically says that this is the only permissible syntax for default initialization. W. -- What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19610
[Bug c++/19610] default constructor not called for static template member of template class
--- Additional Comments From pinskia at gcc dot gnu dot org 2005-01-24 20:38 --- I think this is invalid because you are just specializing them and nothing else (note the aa2 can be done the non specialized way too but I showed the specialized way): // declare space for them templatetypename T AT BT::a; templatetypename T AAT BT::aa; //specialize Bchar::aa2 template AAchar Bchar::aa2(1); //instantiate them template Achar Bchar::a; template AAchar Bchar::aa; template AAchar Bchar::aa2; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19610
[Bug c++/19610] default constructor not called for static template member of template class
--- Additional Comments From jamesp at trdlnk dot com 2005-01-24 21:19 --- I've tried what you suggested, and it did work, but now I'm confused. Why was the constructor for aa2 called in the original example? Based on what you have said, it sounds like that should not have happened until aa2 was instantiated. If it is working properly then I don't understand why the extra line to instantiate aa2 is necessary in your fix. The fact that I specialized them all the same way and some of them were constructed and others weren't seems odd to me. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19610