Home Dashboard Directory Help

Cannot call static member functions of template types directly from lambdas in C++. by Benjamin Lindley


 as Fixed Help for as Fixed

Sign in
to vote
Type: Bug
ID: 703088
Opened: 11/13/2011 12:57:01 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
User(s) can reproduce this bug


Failure to compile when trying to call a static member function of a type T from a lambda within a function template.
Sign in to post a comment.
Posted by Microsoft on 12/9/2011 at 7:25 PM
Hi -

We have fixed this issue for the next major release. Thank you for reporting it.

Andy Rich
Visual C++ QA
Posted by MS-Moderator07 [Feedback Moderator] on 11/13/2011 at 6:52 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 11/13/2011 at 1:42 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)
Sign in to post a workaround.
Posted by Benjamin Lindley on 11/13/2011 at 1:00 PM
Get a function pointer to the static member function, then call that from within the lambda:

template<typename T>
void example()
auto func = T::bar;
[]() { func(); }();