* Re: Template specialization error for "void" template parameter in GCC
[not found] <OF734C0056.ABAE87B4-ON65257912.003AC0C0-65257912.003AC0C3@tcs.com>
@ 2011-09-21 12:09 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2011-09-21 12:09 UTC (permalink / raw)
To: Himanshu12 G; +Cc: gcc-help
On 21 September 2011 11:41, Himanshu12 G wrote:
>
> Hi ,
> Thanks for your reply, the foo.h is already included.
I'll repeat what I said when you sent this to me off-list:
It isn't in the example code you posted, so you might get more help if
you post a proper example that actually demonstrates the problem, not
pseudo-code or incomplete example code that fails for different
reasons.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Template specialization error for "void" template parameter in GCC
2011-09-21 5:21 himanshu.gupta
@ 2011-09-21 8:15 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2011-09-21 8:15 UTC (permalink / raw)
To: himanshu.gupta; +Cc: gcc-help
On 21 September 2011 06:21, himanshu.gupta wrote:
>
> Hi,
>
> The following code is giving errors while compiling with GCC 4.5.
>
> Foo.h Header File: declaration of template class.
> template<class T>
> class Foo
> {
> void FooBar() const;
> };
>
> Foo.cpp Source File: explicit definitions for member function of template
> class Foo.
> template<>
> void Foo<void>::FooBar () const
> {
> do something...
> }
>
> The above explicit function declaration for "void" is giving error...
> error: template-id 'type<>' for 'void Foo<void>::FooBar() const' does not
> match any template declaration
>
> The same explicit function declarations with other types - int, unsigned
> int, etc. compiles successfully. The explicit specialization for "void"
> however seems to only compile without template<> being added. But I believe
> as per GCC they do require template<>.
>
> Is it an error with GCC for "void" template parameter? Or am I missing
> something with syntax/ GCC compile option?
It looks as though you've forgotten to #include "Foo.h"
^ permalink raw reply [flat|nested] 3+ messages in thread
* Template specialization error for "void" template parameter in GCC
@ 2011-09-21 5:21 himanshu.gupta
2011-09-21 8:15 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: himanshu.gupta @ 2011-09-21 5:21 UTC (permalink / raw)
To: gcc-help
Hi,
The following code is giving errors while compiling with GCC 4.5.
Foo.h Header File: declaration of template class.
template<class T>
class Foo
{
void FooBar() const;
};
Foo.cpp Source File: explicit definitions for member function of template
class Foo.
template<>
void Foo<void>::FooBar () const
{
do something...
}
The above explicit function declaration for "void" is giving error...
error: template-id 'type<>' for 'void Foo<void>::FooBar() const' does not
match any template declaration
The same explicit function declarations with other types - int, unsigned
int, etc. compiles successfully. The explicit specialization for "void"
however seems to only compile without template<> being added. But I believe
as per GCC they do require template<>.
Is it an error with GCC for "void" template parameter? Or am I missing
something with syntax/ GCC compile option?
--
View this message in context: http://old.nabble.com/Template-specialization-error-for-%22void%22-template-parameter-in-GCC-tp32503711p32503711.html
Sent from the gcc - Help mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-09-21 12:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <OF734C0056.ABAE87B4-ON65257912.003AC0C0-65257912.003AC0C3@tcs.com>
2011-09-21 12:09 ` Template specialization error for "void" template parameter in GCC Jonathan Wakely
2011-09-21 5:21 himanshu.gupta
2011-09-21 8:15 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).