Boost C++ Libraries: Ticket #3285: Boost::Circular_Buffer: Copy Constructor Elicits a Warning from GCC 4.0.1 about Parent Constructor https://svn.boost.org/trac10/ticket/3285 <p> 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: </p> <blockquote> <p> /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${<a class="missing wiki">BuildRoot</a>}/Debug -I${<a class="missing wiki">BuildRoot</a>}/Debug/include -I${<a class="missing wiki">BuildRoot</a>}/Debug/boost/include -c test.cpp -o test.o </p> </blockquote> <blockquote> <p> cc1plus: warnings being treated as errors ${<a class="missing wiki">BuildRoot</a>}/Debug/boost/include/boost/circular_buffer/base.hpp: In copy constructor ‘boost::circular_buffer&lt;T, Alloc&gt;::circular_buffer(const boost::circular_buffer&lt;T, Alloc&gt;&amp;) [with T = float, Alloc = std::allocator&lt;float&gt;]’: ${<a class="missing wiki">BuildRoot</a>}/Debug/boost/include/boost/accumulators/statistics/rolling_window.hpp:39: instantiated from ‘boost::accumulators::detail::accumulator_wrapper&lt;Accumulator, Feature&gt;::accumulator_wrapper(const boost::accumulators::detail::accumulator_wrapper&lt;Accumulator, Feature&gt;&amp;) [with Accumulator = boost::accumulators::impl::rolling_window_plus1_impl&lt;float&gt;, Feature = boost::accumulators::tag::rolling_window_plus1]’ ${<a class="missing wiki">BuildRoot</a>}/Debug/boost/include/boost/fusion/container/list/cons.hpp:85: instantiated from ‘boost::fusion::cons&lt;Car, Cdr&gt;::cons(const boost::fusion::cons&lt;Car, Cdr&gt;&amp;) [with Car = boost::accumulators::detail::accumulator_wrapper&lt;boost::accumulators::impl::rolling_window_plus1_impl&lt;float&gt;, boost::accumulators::tag::rolling_window_plus1&gt;, Cdr = boost::fusion::cons&lt;boost::accumulators::detail::accumulator_wrapper&lt;boost::accumulators::impl::rolling_sum_impl&lt;float&gt;, boost::accumulators::tag::rolling_sum&gt;, boost::fusion::cons&lt;boost::accumulators::detail::accumulator_wrapper&lt;boost::accumulators::impl::rolling_count_impl&lt;float&gt;, boost::accumulators::tag::rolling_count&gt;, boost::fusion::cons&lt;boost::accumulators::detail::accumulator_wrapper&lt;boost::accumulators::impl::rolling_mean_impl&lt;float&gt;, boost::accumulators::tag::rolling_mean&gt;, boost::fusion::nil&gt; &gt; &gt;]’ ${<a class="missing wiki">BuildRoot</a>}/Debug/boost/include/boost/accumulators/framework/accumulator_set.hpp:163: instantiated from ‘boost::accumulators::accumulator_set&lt;Sample, Features, Weight&gt;::accumulator_set(const A1&amp;) [with A1 = boost::parameter::aux::tagged_argument&lt;boost::accumulators::tag::rolling_window_size_&lt;0&gt;, size_t&gt;, Sample = float, Features = boost::accumulators::stats&lt;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&gt;, Weight = void]’ test.cpp:160: instantiated from here <strong>${<a class="missing wiki">BuildRoot</a>}/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</strong> </p> </blockquote> <p> 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). </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3285 Trac 1.4.3 gerickson@… Thu, 23 Jul 2009 16:45:07 GMT attachment set https://svn.boost.org/trac10/ticket/3285 https://svn.boost.org/trac10/ticket/3285 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">boost-05.patch</span> </li> </ul> <p> Boost::Circular_Buffer Patch for Explicit Invocation of Parent in Copy Constructor </p> Ticket Jan Gaspar Fri, 24 Jul 2009 08:03:47 GMT <link>https://svn.boost.org/trac10/ticket/3285#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3285#comment:1</guid> <description> <p> 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? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Fri, 24 Jul 2009 14:40:07 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3285#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3285#comment:2</guid> <description> <p> 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. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Jan Gaspar</dc:creator> <pubDate>Wed, 29 Jul 2009 13:20:49 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/3285#comment:3 https://svn.boost.org/trac10/ticket/3285#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> Ticket