Boost C++ Libraries: Ticket #1791: fix warning on MSVC warning level 4 https://svn.boost.org/trac10/ticket/1791 <p> Attached patch fixes a warning in MSVC 8 on warning level 4 by removing a return statement after a throw "call" </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/1791 Trac 1.4.3 Stephan Tue, 08 Apr 2008 19:34:40 GMT attachment set https://svn.boost.org/trac10/ticket/1791 https://svn.boost.org/trac10/ticket/1791 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">lexical_cast_warning.patch</span> </li> </ul> Ticket nasonov Tue, 22 Apr 2008 13:21:38 GMT <link>https://svn.boost.org/trac10/ticket/1791#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1791#comment:1</guid> <description> <p> As you may guess, the return statement was added to supress a warning. </p> <p> Can you please discusss possible workarounds on boost-devel? I don't have time, sorry. </p> <p> Off the top of my head: </p> <p> template&lt;class R, class E&gt; R throw_exception_impl(E const &amp; e) { </p> <blockquote> <p> throw_exception(e); </p> </blockquote> <blockquote> <p> <em> I expect a lot of workarounds around this place return R(); </em></p> </blockquote> <p> } </p> <p> and then </p> <p> throw_exception_impl&lt;Target&gt;(bad_lexical_cast(typeid(Source), typeid(Target))); </p> <p> -- Alex </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Stephan</dc:creator> <pubDate>Tue, 10 Jun 2008 15:56:22 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1791#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1791#comment:2</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/1791#comment:1" title="Comment 1">nasonov</a>: </p> <blockquote class="citation"> <p> As you may guess, the return statement was added to supress a warning. </p> <p> Can you please discusss possible workarounds on boost-devel? I don't have time, sorry. </p> </blockquote> <p> Sure: Here is what Paul came up with: </p> <pre class="wiki">#if (defined _MSC_VER) # pragma warning( push ) # pragma warning( disable : 4702 ) : unreachable code #endif throw_exception(bad_lexical_cast(typeid(Source), typeid(Target))); return Target(); // normally never reached (throw_exception) #if (defined _MSC_VER) # pragma warning( pop ) #endif </pre><p> which looks fine for me. </p> <p> Thanks, </p> <p> Stephan </p> </description> <category>Ticket</category> </item> <item> <author>Richard Webb <richard.webb@…></author> <pubDate>Sun, 05 Oct 2008 17:31:42 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/1791#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1791#comment:3</guid> <description> <p> Attached is a patch that pragmas out this warning, silencing the warnings that i see on VC9.<br /> </p> <p> The patch is slightly different to the previously suggested patch, in that (on VC9 at least), the pragma has to surround the whole function rather than just the return line in order to actually silence the warning. </p> </description> <category>Ticket</category> </item> <item> <author>Richard Webb <richard.webb@…></author> <pubDate>Sun, 05 Oct 2008 17:32:13 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/1791 https://svn.boost.org/trac10/ticket/1791 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">lexical_cast.patch</span> </li> </ul> Ticket sdiederich Mon, 01 Dec 2008 11:50:50 GMT <link>https://svn.boost.org/trac10/ticket/1791#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/1791#comment:4</guid> <description> <p> Ping. Warning is not yet patched in trunk, or release branch, and was therefore not in 1.37. Richard's patch looks good to me. Any chance we can see this included in 1.38? </p> </description> <category>Ticket</category> </item> <item> <author>Richard Webb <richard.webb@…></author> <pubDate>Sat, 30 May 2009 15:14:52 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/1791 https://svn.boost.org/trac10/ticket/1791 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">lexical_cast2.patch</span> </li> </ul> Ticket Richard Webb <richard.webb@…> Sat, 30 May 2009 15:16:04 GMT version, milestone changed https://svn.boost.org/trac10/ticket/1791#comment:5 https://svn.boost.org/trac10/ticket/1791#comment:5 <ul> <li><strong>version</strong> <span class="trac-field-old">Boost 1.35.0</span> → <span class="trac-field-new">Boost Development Trunk</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.40.0</span> </li> </ul> Ticket nasonov Sat, 12 Sep 2009 21:34:50 GMT milestone changed https://svn.boost.org/trac10/ticket/1791#comment:6 https://svn.boost.org/trac10/ticket/1791#comment:6 <ul> <li><strong>milestone</strong> <span class="trac-field-old">Boost 1.40.0</span> → <span class="trac-field-new">Boost 1.41.0</span> </li> </ul> Ticket nasonov Sat, 12 Sep 2009 21:47:28 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/1791#comment:7 https://svn.boost.org/trac10/ticket/1791#comment:7 <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> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/56158" title="Fix #1791 (fix warning on MSVC warning level 4) and undo r34801 (some ...">[56158]</a>) Fix <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/1791" title="#1791: Patches: fix warning on MSVC warning level 4 (closed: fixed)">#1791</a> (fix warning on MSVC warning level 4) and undo <a class="changeset" href="https://svn.boost.org/trac10/changeset/34801" title="some &#34;rewording&#34; to avoid spurious level 4 warnings with VC7.1 and VC8 ">r34801</a> (some "rewording" to avoid spurious level 4 warnings with VC7.1 and VC8). </p> Ticket