Opened 13 years ago

Closed 13 years ago

#3285 closed Bugs (fixed)

Boost::Circular_Buffer: Copy Constructor Elicits a Warning from GCC 4.0.1 about Parent Constructor

Reported by: gerickson@… Owned by: Jan Gaspar
Milestone: To Be Determined Component: circular_buffer
Version: Boost 1.39.0 Severity: Problem
Keywords: Cc:

Description

When compiling code that uses, either directly or indirectly, boost::circular_buffer (e.g. accumulators and statistics) with a copious level of warnings enabled and warnings treated as errors enabled, the following is generated for boost::circular_buffer:

/Developer/usr/bin/gcc-4.0 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -W -Wall -Wcast-align -Wextra -Wformat-security -Wpointer-arith -Wwrite-strings -Werror -Wreturn-type -Wformat -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wshadow -Wsign-compare -DDEBUG=1 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mfix-and-continue -fvisibility-inlines-hidden -mmacosx-version-min=10.4 -gdwarf-2 -F${BuildRoot}/Debug -I${BuildRoot}/Debug/include -I${BuildRoot}/Debug/boost/include -c test.cpp -o test.o

cc1plus: warnings being treated as errors ${BuildRoot}/Debug/boost/include/boost/circular_buffer/base.hpp: In copy constructor ‘boost::circular_buffer<T, Alloc>::circular_buffer(const boost::circular_buffer<T, Alloc>&) [with T = float, Alloc = std::allocator<float>]’: ${BuildRoot}/Debug/boost/include/boost/accumulators/statistics/rolling_window.hpp:39: instantiated from ‘boost::accumulators::detail::accumulator_wrapper<Accumulator, Feature>::accumulator_wrapper(const boost::accumulators::detail::accumulator_wrapper<Accumulator, Feature>&) [with Accumulator = boost::accumulators::impl::rolling_window_plus1_impl<float>, Feature = boost::accumulators::tag::rolling_window_plus1]’ ${BuildRoot}/Debug/boost/include/boost/fusion/container/list/cons.hpp:85: instantiated from ‘boost::fusion::cons<Car, Cdr>::cons(const boost::fusion::cons<Car, Cdr>&) [with Car = boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::rolling_window_plus1_impl<float>, boost::accumulators::tag::rolling_window_plus1>, Cdr = boost::fusion::cons<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::rolling_sum_impl<float>, boost::accumulators::tag::rolling_sum>, boost::fusion::cons<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::rolling_count_impl<float>, boost::accumulators::tag::rolling_count>, boost::fusion::cons<boost::accumulators::detail::accumulator_wrapper<boost::accumulators::impl::rolling_mean_impl<float>, boost::accumulators::tag::rolling_mean>, boost::fusion::nil> > >]’ ${BuildRoot}/Debug/boost/include/boost/accumulators/framework/accumulator_set.hpp:163: instantiated from ‘boost::accumulators::accumulator_set<Sample, Features, Weight>::accumulator_set(const A1&) [with A1 = boost::parameter::aux::tagged_argument<boost::accumulators::tag::rolling_window_size_<0>, size_t>, Sample = float, Features = boost::accumulators::stats<boost::accumulators::tag::rolling_mean, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na, mpl_::na>, Weight = void]’ test.cpp:160: instantiated from here ${BuildRoot}/Debug/boost/include/boost/circular_buffer/base.hpp:1069: warning: base class ‘class boost::cb_details::debug_iterator_registry’ should be explicitly initialized in the copy constructor

The fix for this, as suggested by the compiler, is to explicitly invoke the parent constructor in the copy constructor when debugging is enabled (see attached patch).

Attachments (1)

boost-05.patch (562 bytes ) - added by gerickson@… 13 years ago.
Boost::Circular_Buffer Patch for Explicit Invocation of Parent in Copy Constructor

Download all attachments as: .zip

Change History (4)

by gerickson@…, 13 years ago

Attachment: boost-05.patch added

Boost::Circular_Buffer Patch for Explicit Invocation of Parent in Copy Constructor

comment:1 by Jan Gaspar, 13 years ago

Had a look at the patch. I think there should be the same problem in all constructors (not only in copy constructor). Could you test this please?

comment:2 by anonymous, 13 years ago

GCC doesn't seem to care about the non-copy constructors; however, I have tested adding the explicit parent constructor calls to the other, non-copy constructors and that seems to work fine as well.

comment:3 by Jan Gaspar, 13 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.