fake expression

1
2
3
4
5
6
7
8
9
10
11
#include <functional>
using namespace std;

template<typename...Args>
void on(function<void(Args...)> f) {
	function<void(Args...)> fn; // this line causes error C2059: syntax error : '<fake-expression>'
}
int main() {
	function<void()> f;
	on(f);
}

What's the difference between 'f' and 'fn'?

Thanks.
Last edited on
> What's the difference between 'f' and 'fn'?

They are two different objects.
Other than that there is no difference; both are of the same type, and have the same automatic storage duration.
http://liveworkspace.org/code/1JlYQJ$0


Thanks for the reply, the code compiles with g++4.72, but failed with vs2012... seems to be a bug
It is a bug. Also compiles cleanly with clang 3.2.
Topic archived. No new replies allowed.