[Bug c++/17445] too few template-parameter-lists
leslie dot barnes at amd dot com
gcc-bugzilla@gcc.gnu.org
Tue Apr 19 00:02:00 GMT 2005
------- Additional Comments From leslie dot barnes at amd dot com 2005-04-19 00:02 -------
(In reply to comment #6)
> This code has at least two bugs:
>
> template class MyType<Sample>;
> template <> std::map<char*,char*> MyType<Sample>::m_map;
>
> First, the instantiation must come *after* the definition of the static
> member.
> Second, the definition you thought you have written is in fact only the
> declaration of an explicit specialization of that member. It needs an
> initializer. You need to write
>
> template <> std::map<char*,char*> MyType<Sample>::m_map
> = std::map<char*,char*>();
>
> W.
>
(In reply to comment #6)
> This code has at least two bugs:
>
> template class MyType<Sample>;
> template <> std::map<char*,char*> MyType<Sample>::m_map;
>
> First, the instantiation must come *after* the definition of the static
> member.
> Second, the definition you thought you have written is in fact only the
> declaration of an explicit specialization of that member. It needs an
> initializer. You need to write
>
> template <> std::map<char*,char*> MyType<Sample>::m_map
> = std::map<char*,char*>();
>
> W.
>
Great, thanks! If someone could put this on the g++ 3.4.3 changes page, that
would probably save people quite a bit of time.
http://www.gnu.org/software/gcc/gcc-3.4/changes.html
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17445
More information about the Gcc-bugs
mailing list