Modify

Ticket #6535 (closed Bugs: fixed)

Opened 2 years ago

Last modified 2 years ago

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:

Description

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

Change History

comment:1 Changed 2 years ago by eric_niebler

  • Status changed from new to assigned

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 2 years ago by Howard Butler <hobu.inc@…>

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
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

comment:3 Changed 2 years ago by eric_niebler

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

comment:4 Changed 2 years ago by eric_niebler

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged to release in [77589]

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


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

 
Note: See TracTickets for help on using tickets.