Modify

Opened 8 years ago

Closed 8 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@… 8 years ago.
Boost::Circular_Buffer Patch for Explicit Invocation of Parent in Copy Constructor

Download all attachments as: .zip

Change History (4)

Changed 8 years ago by gerickson@…

Attachment: boost-05.patch added

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

comment:1 Changed 8 years ago by Jan Gaspar

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 Changed 8 years ago by anonymous

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 Changed 8 years ago by Jan Gaspar

Resolution: fixed
Status: newclosed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jan Gaspar.
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.