Opened 6 years ago

Closed 6 years ago

#6535 closed Bugs (fixed)

MS VS 2010 compile failure using a droppable accumulator

Reported by: michael.rosen@… Owned by: Eric Niebler
Milestone: To Be Determined Component: accumulator
Version: Boost 1.48.0 Severity: Problem
Keywords: Cc:


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

  • a plain density accumulator is OK
  • a droppable density accumulator fails to compile (missing operator)
  • a droppable sum accumulator is OK.
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/density.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/sum.hpp> 
using namespace boost;
using namespace accumulators;
// OK.  Plain density accumulator.  Compiles fine on VStudio 2010, boost v1.48.0
//typedef accumulator_set<double, features<tag::density> > DensityAcc;

// NG.  Droppable density accumulator causes "error C2676: binary '[' : 'const boost::accumulators::droppable_accumulator<Accumulator>' does not define this operator or a conversion to a type acceptable to the predefined operator"
typedef accumulator_set<double, features< droppable<tag::density>> > DensityAcc;

// OK.  Droppable sum accumulator seems OK.
// typedef accumulator_set<double, features< droppable<tag::sum>> > SumAcc;
int main()
  DensityAcc myAccumulator( tag::density::num_bins = 20, tag::density::cache_size = 10);
  //SumAcc myAccumulator;
  return 0;

Attachments (0)

Change History (4)

comment:1 Changed 6 years ago by Eric Niebler

Status: newassigned

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 [77417]), and will be merged to release as soon as the tests cycle. Thanks.

comment:2 Changed 6 years ago by Howard Butler <…>

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.

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<Accumulator>::droppable_accumulator(const pdalboost::accumulators::droppable_accumulator<Accumulator>&)':
/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 `>'
/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

comment:3 Changed 6 years ago by Eric Niebler

Ah, right. Forgot a typename. Fixed on trunk as of [77437].

comment:4 Changed 6 years ago by Eric Niebler

Resolution: fixed
Status: assignedclosed

Merged to release in [77589]

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Eric Niebler.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.