Can I change the code, so that the VS2010 compiler's error message points to the offending line of code?
class NoCopy
{ //<-- error shows up here
NoCopy( const NoCopy& ); //<-- and error shows up here
NoCopy& operator=( const NoCopy& );
public:
NoCopy(){};
};
struct AnotherClass :NoCopy
{
}; //<-- and error shows up here
int _tmain(int argc, _TCHAR* argv[])
{
AnotherClass c;
AnotherClass d = c; //<-- but the error does not show up here
return 0;
}
Note that 'NoCopy( const NoCopy& ) = delete;' does not compile in VS2010. I can not use boost.
This was added per Micheal's suggestion:
1>------ Build started: Project: Test, Configuration: Debug Win32 ------
1> Test.cpp
1>c:\Test\Test.cpp(16): error C2248: 'NoCopy::NoCopy' : cannot access private member declared in class 'NoCopy'
1> c:\Test\Test.cpp(8) : see declaration of 'NoCopy::NoCopy'
1> c:\Test\Test.cpp(7) : see declaration of 'NoCopy'
1> This diagnostic occurred in the compiler generated function 'AnotherClass::AnotherClass(const AnotherClass &)'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========