This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Static data members in template declarations
> But this is my point; you are asking that the compiler figure this out
> while parsing the definition of the array.
I could not actually locate a statement in the FDIS that would clarify
this. Closest I found is in [basic.def.odr]/5.
Consider we have two translation units, one contains the declaration
and
int S<T>::k[S<T>::a];
and the other contains
int S<T>::k[a];
Such a program would be ill-formed, since the definitions do not
consist of the same sequence of tokens. It seems that Mark has a
similar requirement in mind.
OTOH, the requirement for redeclaration/definition of functions is
much weaker. [dcl.fct]/3 says
>> All declarations for a function with a given parameter list shall
>> agree exactly both in the type of the value returned and in the
>> number and type of parameters;
I'm not sure under which conditions template functions agree in the
type of parameters.
Regards,
Martin