Can I change the code so that the VS2010 compiler error message points to a line with a code violation?
class NoCopy
{
NoCopy( const NoCopy& );
NoCopy& operator=( const NoCopy& );
public:
NoCopy(){};
};
struct AnotherClass :NoCopy
{
};
int _tmain(int argc, _TCHAR* argv[])
{
AnotherClass c;
AnotherClass d = c;
return 0;
}
Note that 'NoCopy (const NoCopy &) = delete;' not compiled in VS2010. I can not use boost.
This was added at the suggestion of Micah:
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 ==========
source
share