Can somebody help me spot the error here?

I'm getting the following errors when I try to build this simple program. I'm using Visual Studio 2013 Express for Windows Desktop.

1
2
3
4
Error 1 error C2059: syntax error : ';'	
Error 2 error C2238: unexpected token(s) preceding ';'
Error 3	error C2059: syntax error : ';'
Error 4	error C2238: unexpected token(s) preceding ';'	


This is the class definition that's causing the problems.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class thread_helper  {

	std::thread& m_thread;

public:
	explicit thread_helper(std::thread& t) : m_thread(t) {}

	~thread_helper() {
		if (m_thread.joinable()) 
			m_thread.join();
	}

	thread_helper(const thread_helper& other) = delete;
	thread_helper& operator=(const thread_helper& rhs) = delete;
};


The errors are occurring where I delete the copy constructor and the assignment operator. It's like there's a phantom semicolon somewhere or that VS doesn't know what 'delete' means. But I've used it before with no problems. Is there something I'm not catching or is Visual Studio bugging out on me?
closed account (o1vk4iN6)
I'm not sure if that delete syntax is even valid in vs2013, at least it still wasn't supported in vs2012.
Last edited on
Have you got C++11 support switched on? If so, my guess is that that's a C++11 feature that's not supported by your version of VS, like xerzi says.
Okay, apparently deleted functions aren't supported. I must be losing my mind because I know I've used them before.
Is support for C++11, or for this particular feature, something you have to specifically switch on in the Project Settings?
As far as I'm aware all C++11 features currently available should be enabled by default, so no. Visual Studio 2013 is currently just a preview so it is still undergoing active development and one of the features being developed is deleted functions.

I must have been using gcc when I used them. Because I know I've used them before. Either that or I really am losing my mind :)
Topic archived. No new replies allowed.