This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: template specializiation
Thomas,
Sure. What version of Visual Studio are you using as I don't know
that I've had to use this in my MSVC development yet.
14.7.3.15
An explicit specialization of a static data member of a template is a
definition if the declaration includes an
initializer; otherwise, it is a declaration. [Note: there is no syntax
for the definition of a static data member
of a template that requires default initialization.
template<> X Q<int>::x;
This is a declaration regardless of whether X can be default
initialized (8.5). ]
corey
On 7/7/05, Thomas Neumann <tneumann@users.sourceforge.net> wrote:
> Hi,
>
> > Would this not work for you?
> >
>
> > template<> const A B<d>::b;
> > template<> const A B<c>::b;
> >
> > template<> const A B<c>::b = { &B<d>::b };
> > template<> const A B<d>::b = { &B<c>::b };
>
> hmm, perhaps it _should_ work :) Gcc and Comeau accept it, but Microsoft
> and Borland complain about multiple definitions of B<d>::b and B<c>::d.
> Perhaps I see compiler bugs here, but I would think that they are right.
> Any pointers to the standard?
>
> Thomas
>