Boost C++ Libraries: Ticket #6535: MS VS 2010 compile failure using a droppable accumulator https://svn.boost.org/trac10/ticket/6535 <p> We are using Boost 1.48.0 and found a compilation failure on Windows using VS 2010. The project builds properly on Linux and OSX. I've provided a concise repro below. In short </p> <ul><li>a plain density accumulator is OK </li><li>a droppable density accumulator fails to compile (missing operator) </li><li>a droppable sum accumulator is OK. </li></ul><pre class="wiki">#include &lt;boost/accumulators/accumulators.hpp&gt; #include &lt;boost/accumulators/statistics/density.hpp&gt; #include &lt;boost/accumulators/statistics/stats.hpp&gt; #include &lt;boost/accumulators/statistics/sum.hpp&gt; using namespace boost; using namespace accumulators; // OK. Plain density accumulator. Compiles fine on VStudio 2010, boost v1.48.0 //typedef accumulator_set&lt;double, features&lt;tag::density&gt; &gt; DensityAcc; // NG. Droppable density accumulator causes "error C2676: binary '[' : 'const boost::accumulators::droppable_accumulator&lt;Accumulator&gt;' does not define this operator or a conversion to a type acceptable to the predefined operator" typedef accumulator_set&lt;double, features&lt; droppable&lt;tag::density&gt;&gt; &gt; DensityAcc; // OK. Droppable sum accumulator seems OK. // typedef accumulator_set&lt;double, features&lt; droppable&lt;tag::sum&gt;&gt; &gt; SumAcc; int main() { DensityAcc myAccumulator( tag::density::num_bins = 20, tag::density::cache_size = 10); //SumAcc myAccumulator; return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6535 Trac 1.4.3 Eric Niebler Mon, 19 Mar 2012 22:02:07 GMT status changed https://svn.boost.org/trac10/ticket/6535#comment:1 https://svn.boost.org/trac10/ticket/6535#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Confirmed. This is due to a compiler bug in msvc which allows ctor template to be used as copy constructors. The problem has been worked around on trunk (commit <a class="changeset" href="https://svn.boost.org/trac10/changeset/77417" title="work around for msvc which allows ctor templates to be copy ctors">[77417]</a>), and will be merged to release as soon as the tests cycle. Thanks. </p> Ticket Howard Butler <hobu.inc@…> Tue, 20 Mar 2012 13:17:59 GMT <link>https://svn.boost.org/trac10/ticket/6535#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6535#comment:2</guid> <description> <p> The second half of this patch fails to compile for me on llvm-gcc 4.2 on apple. It doesn't like the cast. Note that these files were namespaced and embedded with bcp, but it didn't appear as though that should have any impact on the patch. It's possible I'm missing something obvious though. </p> <pre class="wiki">In file included from /Users/hobu/dev/git/pdal/boost/boost/accumulators/framework/accumulator_set.hpp:28, from /Users/hobu/dev/git/pdal/boost/boost/accumulators/accumulators.hpp:12, from /Users/hobu/dev/git/pdal/src/../include/pdal/filters/Stats.hpp:46, from /Users/hobu/dev/git/pdal/src/StageFactory.cpp:80: /Users/hobu/dev/git/pdal/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp: In copy constructor 'pdalboost::accumulators::droppable_accumulator&lt;Accumulator&gt;::droppable_accumulator(const pdalboost::accumulators::droppable_accumulator&lt;Accumulator&gt;&amp;)': /Users/hobu/dev/git/pdal/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp:173: error: expected type-specifier /Users/hobu/dev/git/pdal/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp:173: error: expected `&gt;' /Users/hobu/dev/git/pdal/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp:173: error: expected `(' /Users/hobu/dev/git/pdal/boost/boost/accumulators/framework/accumulators/droppable_accumulator.hpp:173: error: expected `)' before 'const' /Users/hobu/dev/git/pdal/src/StageFactory.cpp: In member function 'void pdal::StageFactory::loadPlugins()': /Users/hobu/dev/git/pdal/src/StageFactory.cpp:466: warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object make[2]: *** [src/CMakeFiles/pdal.dir/StageFactory.cpp.o] Error 1 make[1]: *** [src/CMakeFiles/pdal.dir/all] Error 2 make: *** [all] Error 2 [hobu@fire pdal (master)]$ g++ --version i686-apple-darwin10-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00) Copyright (C) 2007 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Tue, 20 Mar 2012 19:53:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/6535#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6535#comment:3</guid> <description> <p> Ah, right. Forgot a <code>typename</code>. Fixed on trunk as of <a class="changeset" href="https://svn.boost.org/trac10/changeset/77437" title="add missing typename">[77437]</a>. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Eric Niebler</dc:creator> <pubDate>Tue, 27 Mar 2012 19:29:08 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6535#comment:4 https://svn.boost.org/trac10/ticket/6535#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Merged to release in <a class="changeset" href="https://svn.boost.org/trac10/changeset/77589" title="merge [77417],[77437],[77422],[77587] from trunk">[77589]</a> </p> Ticket