A compiler error:1>c:\program files\microsoft visual studio 11.0\vc\include\mutex(304): error C4716: 'std::unique_lock<std::mutex>::try_lock' : must return a valueoccurs when compiling the following program:#include "stdafx.h"#include <mutex>std::mutex m;int _tmain(int argc, _TCHAR* argv[]){ std::unique_lock<std::mutex> lock_a(m, std::defer_lock); lock_a.try_lock(); return 0;}The try_lock method of std::unique_lock must return a value. A possible fix would be:bool try_lock() _NOEXCEPT{ // try to lock the mutex _Owns = _Pmtx->try_lock(); return (_Owns);}
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results