Using the following (simple) example:
class Foo
{
public:
Foo() { value = 0; };
Foo& operator<<(const Foo&) { value++; return *this; };
int value;
};
void doFoo()
{
Foo f;
f << Foo();
f << Foo();
//f.value == 2
}
//After "Extract Method" refactoring:
//MyMethod should either take a (Foo& f) or possibly return a Foo (if Foo supports the assignment operator)
void MyMethod(Foo f)
{
f << Foo();
}
void doFooAfterExtractMethod()
{
Foo f;
MyMethod(f);
MyMethod(f);
//f.value == 0
}
I (fortunately) noticed because the orignal class (QTextStream) does not have a copy constructor (QTextStream(const QTextStream&) = delete) - can you check why the refactoring produces incorrect code in this case?
System Info:
Visual Studio 2015 Update 3, C++
License: [email protected] (2-user license) Support ends 2019.06.14
VA_X.dll file version 10.9.2283.2 built 2018.08.02
DevEnv.exe version 14.0.25420.1 Professional
msenv.dll version 14.0.25431.1
Comctl32.dll version 6.10.17134.285
Windows 10 10.0 Build 17134.285
8 processors (x86-64, WOW64)
Language info: 1252, 0x407