This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17445] too few template-parameter-lists
- From: "leslie dot barnes at amd dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Apr 2005 00:02:04 -0000
- Subject: [Bug c++/17445] too few template-parameter-lists
- References: <20040913003933.17445.carlson14@llnl.gov>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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