------- Additional Comments From ramya dot chandar at wipro dot com 2005-03-08 09:44 ------- (In reply to comment #9) > Invalid, as what you are doing is called explicit specializtion and when this happens you instantiate the > template and now you are violating the one defintional rule (which is 14.7/5 in the C++ standard). > > Note that if you use 3.4.0, it works with adding template<>.
(In reply to comment #9) > Invalid, as what you are doing is called explicit specializtion and when this happens you instantiate the > template and now you are violating the one defintional rule (which is 14.7/5 in the C++ standard). > > Note that if you use 3.4.0, it works with adding template<>. Since solving this Compiler error is very critical to us, We made some more investigation in our code to see if it violates the one defintional rule of C++. Here is our consolidated investigation. Explicit template specialization itself does NOT instantiate the template. It only specializes it. Hence, we feel, it is not violating any C++ standard rules. E.g., template<class T> class A { public: void f(T t) { /* ... */ } // definition in general case }; template<> void A<int>::f(int i) { /* ... */ } // definition in specific, i.e., 'T=int' case The above code does NOT instantiate the template, it only does explicit specialization of its 'f' member function for the case of 'T= int'. Template instantiation is an another issue, and it can happen either implicitly or explicitly. Implicit template instantiation happens when the template is being used in the way that its usage requires the instantiation. E.g., A<int>* aP; // No instantiation happens! A<int> a; // Implicit template instantiation happens! Explicit template instantiation happens when the explicit template instantiation syntax is applied. E.g., template class A<int>; template void A<int>::f(int); template class A<char>; Looking at our IOCM Sequence.hh and Sequence.impl files, within these files the templates, that generate errors with the new GNU compiler( 3.3.2), are surely NOT instantiated. However it is true that the template specializations in the Sequence.impl files should have template<> prefix (but most of the compilers are actually accept them without this as well). I checked these files with the Microsoft Visual Studio .Net 2003 which is commonly known as having one of the compilers that most follow the C++ standard. With this compiler everything compiles well (in fact, with or without the template<> prefix). Can you please explain us, if it is the problem with GCC 3.3.2 compiler. surprisingly, with GCC 2.95.3 compiler, we are able to compile the same code without any changes. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18306