std::result_of not working with lambdas - by Sylvester Hesp

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 689815 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 9/20/2011 3:39:33 PM
Access Restriction Public
Moderator Decision Sent to Engineering Team for consideration

Description

Consider the following piece of code

==============
#include <functional>

int main()
{
	auto f = [](int i) { return 0.f; };
	typedef decltype(f) f_type;
	std::result_of<f_type(int)>::type v;
}
==============

This fails to compile, and will result in the error:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xxresult(28): error C2903: 'result' : symbol is neither a class template nor a function template

Apparently, a lambda doesn't define a result_type typedef. Now, C++11 doesn't say that it should, but then again, C++11 defines result_of<> using decltype(). Perhaps VC++ should implement result_of similarly? Or, in the mean time, simply add a result_type typedef to the compiler generated function object.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:23 PM
Thank you for reporting this issue. This issue has been fixed in Visual Studio 2013. You can install a trial version of Visual Studio 2013 with the fix from: http://go.microsoft.com/?linkid=9832436
Posted by Microsoft on 9/21/2011 at 10:44 AM
Hi:
    This issue has been fixed and it should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by MS-Moderator07 [Feedback Moderator] on 9/20/2011 at 10:21 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.

Posted by MS-Moderator01 on 9/20/2011 at 4:45 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)