Boost C++ Libraries: Ticket #2395: [filesystem] operations_test regression test fails on MSVC with STDCXX https://svn.boost.org/trac10/ticket/2395 <blockquote> <p> The operations_test regression test fails on MSVC with STDCXX: <a class="ext-link" href="http://tinyurl.com/53m6t4"><span class="icon">​</span>http://tinyurl.com/53m6t4</a> </p> </blockquote> <blockquote> <p> The reason is checking in libs/filesystem/test/operation_test.cpp, lines 149-150 : </p> </blockquote> <pre class="wiki"> try { fs::create_directory( "no-such-dir/foo/bar" ); } catch ( std::runtime_error x ) { exception_thrown = true; if ( report_throws ) std::cout &lt;&lt; x.what() &lt;&lt; std::endl; if ( platform == "Windows" &amp;&amp; language_id == 0x0409 ) // English (United States) BOOST_CHECK( std::strcmp( x.what(), "boost::filesystem::create_directory" ) == 0 ); } </pre><blockquote> <p> Our implementation of the copy ctor (as well as assignment operator) of the std::runtime_error class </p> </blockquote> <p> copying the resulting string of the what() method of the operand. </p> <blockquote> <p> So that in the following code the all three assertions will pass: </p> </blockquote> <pre class="wiki"> boost::system::system_error se(3, boost::system::get_system_category(), "boost::filesystem::create_directory"); std::runtime_error re = se; assert (0 != std::strcmp (re.what(), "boost::filesystem::create_directory")); assert (0 == std::strcmp (re.what(), se.what())); assert (0 == std::strcmp (re.what(), "boost::filesystem::create_directory: The system cannot find the path specified: \"no-such-dir\\foo\\bar\"")); </pre><blockquote> <p> The proposed patch: </p> </blockquote> <pre class="wiki">Index: libs/filesystem/test/operations_test.cpp =================================================================== --- libs/filesystem/test/operations_test.cpp (revision 49179) +++ libs/filesystem/test/operations_test.cpp (working copy) @@ -146,8 +146,9 @@ exception_thrown = true; if ( report_throws ) std::cout &lt;&lt; x.what() &lt;&lt; std::endl; if ( platform == "Windows" &amp;&amp; language_id == 0x0409 ) // English (United States) - BOOST_CHECK( std::strcmp( x.what(), - "boost::filesystem::create_directory" ) == 0 ); + BOOST_CHECK( std::strncmp( x.what(), + "boost::filesystem::create_directory", + sizeof("boost::filesystem::create_directory")-1 ) == 0 ); } BOOST_CHECK( exception_thrown ); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/2395 Trac 1.4.3 Beman Dawes Sat, 11 Oct 2008 12:36:14 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/2395#comment:1 https://svn.boost.org/trac10/ticket/2395#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Thanks! </p> <p> --Beman </p> Ticket