Boost C++ Libraries: Ticket #10830: Clang static analyzer warns about <boost/graph/named_function_params.hpp> https://svn.boost.org/trac10/ticket/10830 <p> When running the clang static analyzer (v3.4.1) on some code of mine that uses boost graph, it reports this warning about boost/graph/named_function_params.hpp: </p> <p> /usr/local/include/boost/graph/named_function_params.hpp:240:5: warning: Address of stack memory associated with temporary object of type 'boost::param_not_found' returned to caller </p> <blockquote> <p> return lookup_named_param_def&lt;Tag, Args, param_not_found&gt;::get(p, param_not_found()); <sup><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del></del><del>~ </del></sup></p> </blockquote> <p> 1 warning generated. </p> <p> I believe that's a genuine error. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10830 Trac 1.4.3 anonymous Wed, 04 Nov 2015 11:49:06 GMT <link>https://svn.boost.org/trac10/ticket/10830#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10830#comment:1</guid> <description> <p> vs2015 generates an error for this in x64 release build: </p> <p> c:\boost\boost_1_59_0_vs2015\x64\boost\graph\named_function_params.hpp(240): error C4172: returning address of local variable or temporary </p> <blockquote> <p> return lookup_named_param_def&lt;Tag, Args, param_not_found&gt;::get(p, param_not_found()); </p> </blockquote> <p> see also http: connect.microsoft.com/VisualStudio/feedback/details/1425276/false-positive-error-c4172-returning-address-of-local-variable-or-temporary </p> </description> <category>Ticket</category> </item> <item> <author>Diego Barrios Romero <eldruin@…></author> <pubDate>Fri, 04 Nov 2016 16:54:33 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/10830 https://svn.boost.org/trac10/ticket/10830 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">param_not_found_static_instance.patch</span> </li> </ul> <p> Workaround on boost 1.62 sources to get MSVC14 to compile </p> Ticket Diego Barrios Romero <eldruin@…> Fri, 04 Nov 2016 17:10:36 GMT <link>https://svn.boost.org/trac10/ticket/10830#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10830#comment:2</guid> <description> <p> This also affects boost 1.62 which cannot be compiled with VS2015 (MSVC14). I attached a patch with an ugly workaround. </p> <p> It adds a static instance of the param_not_found structure. A reference to this "singleton" object will be returned if necessary. As the structure itself is empty, wrong code could not do much with it. Furthermore, I imagine the whole param_not_found is just a construct to get the whole named-parameter system to work and the actual object returned will never be used in this case. </p> <p> I would be happy if someone reports a nicer solution. I would also be happy to submit this as a PR in github if you want. </p> </description> <category>Ticket</category> </item> <item> <author>fmilano@…</author> <pubDate>Fri, 14 Jul 2017 17:21:24 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10830#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10830#comment:3</guid> <description> <p> This also affects boost 1.64 in VS2015 (MSVC14) </p> </description> <category>Ticket</category> </item> <item> <author>Petr Kmoch <petr.kmoch@…></author> <pubDate>Tue, 14 Nov 2017 08:25:01 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10830#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10830#comment:4</guid> <description> <p> I am getting the same in Boost 1.65.0 and VS 2017. It's quite annoying not to be able to use "warnings as errors" because of this. </p> </description> <category>Ticket</category> </item> <item> <author>aaron@…</author> <pubDate>Wed, 14 Mar 2018 13:38:31 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10830#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10830#comment:5</guid> <description> <p> I get the same with Clang-5.0 on ubuntu 16.04 </p> </description> <category>Ticket</category> </item> </channel> </rss>