public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* libstdc++/3551: error in auto_ptr implementation
@ 2001-07-03 15:26 Matthias Klose
0 siblings, 0 replies; 4+ messages in thread
From: Matthias Klose @ 2001-07-03 15:26 UTC (permalink / raw)
To: gcc-gnats, debian-gcc
>Number: 3551
>Category: libstdc++
>Synopsis: error in auto_ptr implementation
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Jul 03 15:26:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Wichert Akkerman <wichert@cistron.nl>
>Release: 3.0 (Debian GNU/Linux)
>Organization:
The Debian project
>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:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++/3551: error in auto_ptr implementation
@ 2001-07-03 16:17 gdr
0 siblings, 0 replies; 4+ messages in thread
From: gdr @ 2001-07-03 16:17 UTC (permalink / raw)
To: Laurent.Bonnaud, 101371-quiet, gcc-bugs, gcc-prs, gdr, nobody, wichert
Synopsis: error in auto_ptr implementation
Responsible-Changed-From-To: unassigned->gdr
Responsible-Changed-By: gdr
Responsible-Changed-When: Tue Jul 3 16:17:46 2001
Responsible-Changed-Why:
Analysed.
State-Changed-From-To: open->closed
State-Changed-By: gdr
State-Changed-When: Tue Jul 3 16:17:46 2001
State-Changed-Why:
Not a bug. The code shown is ill-formed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3551&database=gcc
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++/3551: error in auto_ptr implementation
@ 2001-07-03 16:16 Gabriel Dos Reis
0 siblings, 0 replies; 4+ messages in thread
From: Gabriel Dos Reis @ 2001-07-03 16:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/3551; it has been noted by GNATS.
From: Gabriel Dos Reis <Gabriel.Dos-Reis@cmla.ens-cachan.fr>
To: 101371-quiet@bugs.debian.org
Cc: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org,
Matthias Klose <doko@klose.in-berlin.de>
Subject: Re: libstdc++/3551: error in auto_ptr implementation
Date: 04 Jul 2001 01:13:39 +0200
Matthias Klose <doko@klose.in-berlin.de> writes:
| The code below does not compile with g++ 3.0, but it seems correct
| judging by my C++ books.
No serious up-to-date C++ book can claim the code below should work.
| list<auto_ptr<int> > lapi;
That is incorrect: You cannot put an auto_ptr<> in a standard
container, by design.
| This one is much more complicated. I agree with Wichert that this
| should work,
No, the code is ill-formed.
-- Gaby
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++/3551: error in auto_ptr implementation
@ 2001-07-03 16:16 Ross Smith
0 siblings, 0 replies; 4+ messages in thread
From: Ross Smith @ 2001-07-03 16:16 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR libstdc++/3551; it has been noted by GNATS.
From: Ross Smith <ross.s@ihug.co.nz>
To: 101371-quiet@bugs.debian.org
Cc: gcc-gnats@gcc.gnu.org, debian-gcc@lists.debian.org
Subject: Re: libstdc++/3551: error in auto_ptr implementation
Date: Wed, 04 Jul 2001 11:13:54 +1200
Matthias Klose wrote:
>
> 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;
> }
This is not supposed to work. STL containers of auto_ptr are illegal
(23.1 para 3, container elements must be CopyConstructible and
Assignable; auto_ptr is neither).
--
Ross Smith <ross.s@ihug.co.nz> The Internet Group, Auckland, New Zealand
========================================================================
"Unix has always lurked provocatively in the background of the operating
system wars, like the Russian Army." -- Neal Stephenson
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-07-03 16:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-03 15:26 libstdc++/3551: error in auto_ptr implementation Matthias Klose
2001-07-03 16:16 Gabriel Dos Reis
2001-07-03 16:16 Ross Smith
2001-07-03 16:17 gdr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).