Hello,
This is not a boost-related issue (except the fact that enable_if is
used), but it might be of interest to the boost-users community.
The following bug was detected in some compicated environment, but the
following seems to be the minimal construct where it appears (compile
in Debug mode; see comments in Test::func() ).
// main.cpp
#include
#include
class BasicVersion
{};
template class Version1 : public
BasicVersion
{
protected:
Version1() : verData_(2)
{}
void go()
{
verData_ = 3;
}
int verData_;
};
template class TestBase
{};
template<typename Param> class TestBase::type> : public
Version1<Param>
{};
template<class Param> class Test : private boost::noncopyable, public
TestBase<Param>
{
public:
void func()
{
go(); // This works well
TestBase::go(); // This jumps to an incorrect place (bad "this"),
verData_ contains garbage
/*
the following code is generated for the previous 2 calls:
go();
004116D3 mov ecx,dword ptr [this]
004116D6 add ecx,4
004116D9 call Version1::go (4110F5h)
TestBase::go();
004116DE mov ecx,dword ptr [this]
004116E1 add ecx,8
004116E4 call Version1::go (4110F5h)
*/
}
private:
int data_;
};
int main()
{
Test<int> test;
test.func();
}