error in auto_ptr implementation
>Submitter-Id: net
>Originator: Wichert Akkerman <wichert@cistron.nl>
>Organization: The Debian project
>Confidential: no
>Synopsis: error in auto_ptr implementation
>Severity: serious
>Priority: medium
>Category: libstdc++
>Class: rejects-legal
>Release: 3.0 (Debian GNU/Linux)
>Environment:
System: Debian GNU/Linux (testing/unstable)
Architecture: i686
host: i386-linux
build: i386-linux
target: i386-linux
configured with: ../src/configure -v --enable-languages=c,c++,java,f77,proto,objc --prefix=/usr --infodir=/share/info --mandir=/share/man --enable-shared --with-gnu-as --with-gnu-ld --with-system-zlib --enable-long-long --enable-nls --without-included-gettext --disable-checking --enable-threads=posix --enable-java-gc=boehm --with-cpp-install-dir=bin --enable-objc-gc i386-linux
>Description:
[ Reported to the Debian BTS as report #101371.
Please CC 101371-quiet@bugs.debian.org on replies.
Log of report can be found at http://bugs.debian.org/101371 ]
The code below does not compile with g++ 3.0, but it seems correct
judging by my C++ books.
Wichert.
#include <memory>
#include <list>
using namespace std;
int main(int, char**) {
auto_ptr<int> api(new int(5));
list<auto_ptr<int> > lapi;
lapi.push_back(api);
return 0;
}
[Comment by Laurent Bonnaud <Laurent.Bonnaud@inpg.fr>:]
This one is much more complicated. I agree with Wichert that this
should work, but this is much more involved. I could not think about
an easy fix.
If you look at /usr/include/g++-v3/bits/std_memory.h, you'll see this
comment that lacks precision:
// According to the C++ standard, these conversions are required. Most
// present-day compilers, however, do not enforce that requirement---and,
// in fact, most present-day compilers do not support the language
// features that these conversions rely on.
The methods it refers too are crucial in making this testcase work. So
the real question is: does g++ 3.0 support the necessary language
features ?
>How-To-Repeat:
>Fix:
Reply to: