W
Werner Henze
Hi folks,
I found a bug in VS .NET 2003. When compiling the following code with FAIL defined
I get an error C2352
'B<T>::g::B<T>::g': Unzulässiger Aufruf einer nicht statischen Memberfunktion
with
[
T=COuter::Element *
]
and
[
T=COuter::Element *
]
Since g is not static I believe this is a compiler error. It works with the two
workarounds presented for f and f2. The error does not occur if FAIL is not
defined.
template <class T> class B {
public:
virtual bool f() const { return true; }
virtual bool g() const { return true; }
};
#undef FAIL
#define FAIL
#ifdef FAIL
class COuter
{
#endif
class Element {
};
typedef B<Element *> B_2;
class CInner : public B_2
{
// These work
virtual bool f () const { return B<Element *>::f(); }
virtual bool f2() const { return __super::f(); }
// This fails
virtual bool g () const { return B_2::g(); }
};
#ifdef FAIL
};
#endif
Kind regards,
Werner Henze
I found a bug in VS .NET 2003. When compiling the following code with FAIL defined
I get an error C2352
'B<T>::g::B<T>::g': Unzulässiger Aufruf einer nicht statischen Memberfunktion
with
[
T=COuter::Element *
]
and
[
T=COuter::Element *
]
Since g is not static I believe this is a compiler error. It works with the two
workarounds presented for f and f2. The error does not occur if FAIL is not
defined.
template <class T> class B {
public:
virtual bool f() const { return true; }
virtual bool g() const { return true; }
};
#undef FAIL
#define FAIL
#ifdef FAIL
class COuter
{
#endif
class Element {
};
typedef B<Element *> B_2;
class CInner : public B_2
{
// These work
virtual bool f () const { return B<Element *>::f(); }
virtual bool f2() const { return __super::f(); }
// This fails
virtual bool g () const { return B_2::g(); }
};
#ifdef FAIL
};
#endif
Kind regards,
Werner Henze