GNOME Bugzilla – Bug 733752
Unit tests should enable C++11 lambda expression cases when compiling with Visual Studio 2012, 2013
Last modified: 2014-07-29 07:37:55 UTC
Created attachment 281715 [details] [review] Enable C++11 lambda expressions when compiling with Microsoft Visual Studio 2012 and later. Testing a patch set for bug 724496 with Visual Studio 2013, I observed that the test_cpp11_lambda and test_track_obj unit tests emitted the message "The compiler capabilities don't allow test of C++11 lambda expressions." Visual Studio 2012 and 2013 support C++11 lambdas, so I've attached a patch which defines USING_CPP11_LAMBDA_EXPRESSIONS when _MSCVER >= 1700 (Visual Studio 2012 or later).
Why is this necessary? What's the value of __cplusplus? If Visual Studio 2012 and 2013 support C++11, they should #define __cplusplus 201103L g++ 4.8.2 and clang++ 3.4 without extra compiler options set __cplusplus = 199711. With the compiler option -std=c++11 they define __GXX_EXPERIMENTAL_CXX0X__ and set __cplusplus = 201103. The test for __GXX_EXPERIMENTAL_CXX0X__ is included in the test programs because some older versions of g++ did not define __cplusplus correctly.
(In reply to comment #1) > Why is this necessary? What's the value of __cplusplus? __cplusplus is still 199711L. =/ http://stackoverflow.com/questions/14131454/visual-studio-2012-cplusplus-and-c-11 http://connect.microsoft.com/VisualStudio/feedback/details/763051/a-value-of-predefined-macro-cplusplus-is-still-199711l
I have pushed the patch with a modified commit message. https://git.gnome.org/browse/libsigc++2/commit/?id=a64385ca50b04f17b5edc35b75d83281d503e383