Possible Duplicate:
C2070 - illegal sizeof operand
Why doesn't the templated version of the code below compile, whereas the same exact code will compile when the (unused) template is removed?
Does not compile:
template <typename T>
class Foo {
public:
static double const vals[];
int run ();
};
template <typename T>
double const Foo<T>::vals[] = { 1, 2,3 };
template <typename T>
inline
int Foo<T>::run () {
return sizeof(vals); // error C2070: 'const double []': illegal sizeof operand
}
Compiles:
class Foo {
public:
static double const vals[];
int run ();
};
double const Foo::vals[] = { 1, 2,3 };
inline
int Foo::run () {
return sizeof(vals);
}