16020 – [3.4 regression] cannot copy __gnu_debug::bitset (original) (raw)

Description Jonathan Wakely 2004-06-16 12:12:11 UTC

This is a FAIL when running the libstdc++ testsuite with -D_GLIBCXX_DEBUG.

testsuite/23_containers/bitset/operations/1.cc fails to link because bitset inherits from _Safe_sequence_base, which has protected but undefined copy ctor and op=, due to this change:

2004-05-22 Benjamin Kosnik <bkoz@redhat.com>

    [PR libstdc++/12854](show%5Fbug.cgi?id=12854 "RESOLVED WORKSFORME - libstdc++ vs. -Weffc++")
    Fixups for -Weffc++.

[snip] * include/debug/safe_base.h (_Safe_sequence_base): Declare copy constructor and assignment operator protected. (_Safe_iterator_base): Same. * include/debug/formatter.h (_Error_formatter): Define copy constructor and assignment operator.

Simplified, the test case is:

#define _GLIBCXX_DEBUG
#include <bitset>
int main()
{
    std::bitset<5> b;
    std::bitset<5> bb(b);
    b = bb;
}

This gets undefined references with recent CVS builds of 3.4 or 3.5

My copies of the standard are packed away so I can't check whether bitset should be copy constructible and assignable.

Dinkumware's docs and the last public draft standard seem to say no (are the copy ctor and op= implied?) while SGI's docs, the v3 sources and Comeau say yes (which is good enough for me).

So I think we should define those members for _Safe_sequence_base.