c++ compiler crashes when creating function pointer using auto and initialising via brackets - by Peeers

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.

Sign in
to vote
ID 780175 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/27/2013 5:02:12 PM
Access Restriction Public


The c++ compiler crashes on Visual Studio 2012 Express on the following code:

#include <iostream>
#include <string>

void someFunc(const std::string &str) { 
  std::cout << str << std::endl; 

int main()
  auto f1 = someFunc;   // <<- OK
  f1("Hello 1");

  auto f2(someFunc);    // <<- Crash
  f2("Hello 2");

  return 0;

On other compilers (g++ 4.6.3, g++ 4.7.2, g++ 4.8.0, clang++ 3.2 and Intel 13.0.1) this works.
Sign in to post a comment.
Posted by Microsoft on 4/29/2014 at 12:30 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 3/12/2013 at 11:30 AM
    Thanks for reporting the issue.
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 2/28/2013 at 2:07 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 2/27/2013 at 5:50 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)