This is somewhat similar to http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=8347&SearchTerms=Extract,Method, but not quite the same. I have boiled it down to the following testcode :
TestClass.h
#pragma once
namespace test {
class SomeTestClass
{
public:
void Foo();
void Bar();
};
};
TestClass.cpp
#include "TestClass.h"
#include <iostream>
using namespace test;
void SomeTestClass::Foo()
{
std::cout << "Foo" << std::endl;
}
void SomeTestClass::Bar()
{
std::cout << "Bar" << std::endl;
}
If I select the content of the method Foo() and then execute the Extract Method refactoring, i get the following in TestClass.cpp:
#include "TestClass.h"
#include <iostream>
using namespace test;
void SomeTestClass::Foo()
{
MyMethod();
}
void SomeTestClass::Bar()
{
std::cout << "Bar" << std::endl;
void MyMethod()
{
std::cout << "Foo" << std::endl;
}
}
If I delete the using directive in TestClass.cpp and put the namespace qualifier in front of the method names, it works fine. Somehow the using namespace messes it up.
Here is my version info:
VA_X.dll file version 10.5.1722.0 built 2009.03.31
Licensed to:
---
DevEnv.exe version 8.0.50727.762
msenv.dll version 8.0.50727.762
Font: Courier New 13(Pixels)
Comctl32.dll version 6.0.2900.5512
Windows XP 5.1 Build 2600 S
2 processors (x86)
Platform: Win32
Stable Includes:
C:\\Programme\\Microsoft Visual Studio 8\\VC\\include;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\include;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\PlatformSDK\\include;
C:\\Programme\\Microsoft Visual Studio 8\\SDK\\v2.0\\include;
C:\\Programme\\Microsoft DirectX SDK (August 2007)\\Include;
C:\\Programme\\Intel\\IPP\\5.3.4.087\\ia32\\include;
C:\\Programme\\Microsoft SDKs\\Windows\\v6.1\\Include;
Other Includes:
Stable Source Directories:
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfc;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\mfcm;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\atlmfc\\src\\atl;
C:\\Programme\\Microsoft Visual Studio 8\\VC\\crt\\src;