I
Ian Collins
Consider the following snippet:
struct X { static bool called; };
struct Y : X
{
Y() { called = true; } // g++ is happy with this
};
template <int N>
struct XT { static bool called; };
template <int N> bool XT<N>::called;
template <int N>
struct YT : XT<N>
{
YT() { called = true; }/ / g++ is unhappy with this
};
int main()
{
YT<0> yt;
}
g++ is unhappy with the assignment to called in YT's constructor:
/tmp/x.cc: In constructor 'YT<N>::YT()':
/tmp/x.cc:16: error: 'called' was not declared in this scope
But it's happy with the non-template version.
Is this a compiler issue, or have I missed something in the standard?
struct X { static bool called; };
struct Y : X
{
Y() { called = true; } // g++ is happy with this
};
template <int N>
struct XT { static bool called; };
template <int N> bool XT<N>::called;
template <int N>
struct YT : XT<N>
{
YT() { called = true; }/ / g++ is unhappy with this
};
int main()
{
YT<0> yt;
}
g++ is unhappy with the assignment to called in YT's constructor:
/tmp/x.cc: In constructor 'YT<N>::YT()':
/tmp/x.cc:16: error: 'called' was not declared in this scope
But it's happy with the non-template version.
Is this a compiler issue, or have I missed something in the standard?