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: 18 Apr 2005 06:38:25 -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-18 06:38 -------
(In reply to comment #2)
> You want:
> template<>
> MyType<Sample> list;
> char *MyType<Sample>::name = "Hello\n";
The following code seg faults with g++ 3.4.3. If I remove the "template <>",
it won't compile. On g++ 3.3, without the "template <>" it is happy and prints
"goodbye". With the "template <>" it also seg faults.
I'd like to know if this is a bug, or my inability to figure out the correct
syntax.
thanks
#include <cstdio>
#include <map>
template <class T> class MyType {
public:
static std::map<char*,char*> m_map;
};
class Sample {
};
template class MyType<Sample>;
template <> std::map<char*,char*> MyType<Sample>::m_map;
int main(int argc, char **argv) {
MyType<Sample>::m_map["hello"]="goodbye";
printf("%s\n",MyType<Sample>::m_map["hello"]);
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17445