This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/18055] seems not possible to specialize a template member function
- From: "ramya dot chandar at wipro dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Oct 2004 03:49:58 -0000
- Subject: [Bug c++/18055] seems not possible to specialize a template member function
- References: <20041019091955.18055.ramya.chandar@wipro.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ramya dot chandar at wipro dot com 2004-10-21 03:49 -------
Subject: Re: seems not possible to specialize a template member
function
I tried the way you have mentioned. Giving the "template<> " in all the
specialized function definitions. But, it didn't work out.
I tried changing the compiler options too.
1) Compiling the template using code with -frepo. The compiler will
generate files with the extension .rpo listing all of the template
instantiations used in the corresponding object files which could be
instantiated there. This also didn't work.
According to the below given info,
2) In the single source file where the full implementation belongs, you
can use either a naming convention or #pragma implementation to indicate
this alternate use of the header file. But, it is of no use.
3) when you include the same header file in a main source file that
declares it as #pragma implementation, the compiler emits code for the
function itself;
If all calls to the function can be inlined, you can avoid emitting the
function by compiling with -fno-implement-inlines. If any calls were not
inlined, you will get linker errors.
Did the compilation with the option fno-implement-inlines
But, it failed for the same reasons.
Thanks,
Ramya.
pinskia at gcc dot gnu dot org wrote:
>------- Additional Comments From pinskia at gcc dot gnu dot org 2004-10-20 13:28 -------
>Two things for specialization you have to define the template functions like:
>template<> IOCM::Status IOCM_SequenceTempl<IOCM::Float>::_unpack(IOCM::MessageBox& msgBox)
>
>instead of the current without "template<>", This is rejected in 3.4.0 and above because of that.
>
>The other thing instead of copy and pasting the preprocessed source, next time please attach it.
>
>
>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18055