Template specialization error for "void" template parameter in GCC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux