fake expression

Jan 26, 2013 at 9:26am
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 Jan 26, 2013 at 9:26am
Jan 26, 2013 at 10:55am
> 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


Jan 26, 2013 at 12:20pm
Thanks for the reply, the code compiles with g++4.72, but failed with vs2012... seems to be a bug
Jan 26, 2013 at 2:33pm
It is a bug. Also compiles cleanly with clang 3.2.
Topic archived. No new replies allowed.