This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/17445] too few template-parameter-lists


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]