public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: auto_ptr with vector doesn´t compile (gcc-2.95   19990602)
  1999-06-30 23:07 auto_ptr with vector doesn´t compile (gcc-2.95 19990602) Marcel Ruff
@ 1999-06-05 10:01 ` Gabriel Dos_Reis
  1999-06-05 10:53 ` auto_ptr with vector doesn´t compile(gcc-2.95 19990602) Martin v. Loewis
  1 sibling, 0 replies; 4+ messages in thread
From: Gabriel Dos_Reis @ 1999-06-05 10:01 UTC (permalink / raw)
  To: Marcel Ruff; +Cc: egcs-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 5419 bytes --]

Marcel Ruff <mr@forstware.de> writes:

| Hi,
| 
| i believe the following little code is correct, but it wont compile
| (Linux glibc,  gcc-2.95 19990602)
| 
| ---------------- CODE -------------
| // autoptr.C
| #include <memory>
| #include <string>
| #include <vector>
| using namespace std;
| int main( int argc, char **argv )
| {
|  typedef auto_ptr<string> StringP;
|  typedef vector<StringP> MyVector;
|  StringP ptr(new string("Hello"));
|  MyVector vec;
|  vec.push_back(ptr);
| }
| ---------------- CODE END ----------
| 
| the push_back() expects a const argument, and some internal code doesnt
| like the const argument.
| It only happens if i use an auto_ptr as argument for push_back()
| 
| Thanks for any help

You can't put an auto_ptr in a container and expect any reasonable
behaviour.  Auto_ptr isn't designed for being put in container.

-- Gaby
>From craig@jcb-sc.com Sat Jun 05 10:20:00 1999
From: craig@jcb-sc.com
To: oliva@dcc.unicamp.br
Cc: craig@jcb-sc.com
Subject: Re: Results for gcc-2.95 19990602 (prerelease) testsuite on sparc-sun-sunos4.1.3
Date: Sat, 05 Jun 1999 10:20:00 -0000
Message-id: <19990605161649.1016.qmail@deer>
References: <199906051030.HAA28328@araguaia.dcc.unicamp.br> <199906051030.HAA28328@araguaia.dcc.unicamp.br>
X-SW-Source: 1999-06/msg00139.html
Content-length: 355

>FAIL: g77.f-torture/execute/u77-test.f compilation,  -O2 -fomit-frame-pointer -finline-functions -funroll-loops 

This looks like a new failure to me.  It might be spurious, or it could
indicate a (very recent?) bug in the gcc back end.  Possibly even something
weird in the g77 front end, of course.  Could someone investigate?

        tq vm, (burley)
>From craig@jcb-sc.com Sat Jun 05 10:20:00 1999
From: craig@jcb-sc.com
To: oliva@dcc.unicamp.br
Cc: craig@jcb-sc.com
Subject: Re: Results for gcc-2.95 19990602 (prerelease) testsuite on mips-sgi-irix5.2
Date: Sat, 05 Jun 1999 10:20:00 -0000
Message-id: <19990605161557.1002.qmail@deer>
References: <199906051049.HAA28552@araguaia.dcc.unicamp.br> <199906051049.HAA28552@araguaia.dcc.unicamp.br>
X-SW-Source: 1999-06/msg00140.html
Content-length: 613

>FAIL: g77.f-torture/execute/u77-test.f execution,  -O0 
>FAIL: g77.f-torture/execute/u77-test.f execution,  -O1 
>FAIL: g77.f-torture/execute/u77-test.f execution,  -O2 
>FAIL: g77.f-torture/execute/u77-test.f execution,  -O2 -fomit-frame-pointer -finline-functions 
>FAIL: g77.f-torture/execute/u77-test.f execution,  -O2 -fomit-frame-pointer -finline-functions -funroll-loops 
>FAIL: g77.f-torture/execute/u77-test.f execution,  -O2 -fomit-frame-pointer -finline-functions -funroll-all-loops 
>FAIL: g77.f-torture/execute/u77-test.f execution,  -Os 

Any idea what's going wrong here?

        tq vm, (burley)
>From bhoel@server.python.net Sat Jun 05 10:29:00 1999
From: Berthold Höllmann <bhoel@server.python.net>
To: egcs-bugs@egcs.cygnus.com
Subject: bugreport
Date: Sat, 05 Jun 1999 10:29:00 -0000
Message-id: <37595E0A.F1529DA2@starship.python.net>
X-SW-Source: 1999-06/msg00141.html
Content-length: 2379

Hello,

gcc on 

>uname -a
Linux pchoel 2.2.5 #4 Sam Mai 22 17:56:56 MEST 1999 i686 unknown

asked me to send a bugreport

>g++ -v --save-temps -fpic  -D__STL_USE_NAMESPACES -I./Include -I./Demo -g -O2 -I/usr/local/include/python1.5 -I/usr/local/include/python1.5 -DHAVE_CONFIG_H -c ./Demo/r.cxx
Reading specs from /opt/lib/gcc-lib/i686-pc-linux-gnu/pgcc-2.91.66/specs
gcc version pgcc-2.91.66 19990314 (egcs-1.1.2 release)
 /opt/lib/gcc-lib/i686-pc-linux-gnu/pgcc-2.91.66/cpp -lang-c++ -v
-I./Include -I./Demo -I/usr/local/include/python1.5
-I/usr/local/include/python1.5 -undef -D__GNUC__=2 -D__GNUG__=2
-D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Di386 -D__i386__
-Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__i386__ -D__linux__ -D__unix
-D__i386 -D__linux -Asystem(posix) -D__EXCEPTIONS -D__OPTIMIZE__ -g
-Asystem(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__
-Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__
-D__PIC__ -D__pic__ -D__STL_USE_NAMESPACES -DHAVE_CONFIG_H ./Demo/r.cxx
r.ii
GNU CPP version pgcc-2.91.66 19990314 (egcs-1.1.2 release) (i386
Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 Include
 Demo
 /usr/local/include/python1.5
 /usr/local/v/include
 /usr/local/qt/include
 /opt/include/g++
 /usr/local/include
 /opt/i686-pc-linux-gnu/include
 /opt/lib/gcc-lib/i686-pc-linux-gnu/pgcc-2.91.66/include
 /usr/include
End of search list.
 /opt/lib/gcc-lib/i686-pc-linux-gnu/pgcc-2.91.66/cc1plus r.ii -quiet
-dumpbase r.cc -g -O2 -version -fpic -o r.s
GNU C++ version pgcc-2.91.66 19990314 (egcs-1.1.2 release)
(i686-pc-linux-gnu) compiled by GNU C version egcs-2.91.66 19990314
(egcs-1.1.2 release).
Include/CXX_Objects.h: In method `int ::Py::String::capacity() const':
In file included from Include/CXX_Extensions.h:8,
                 from Demo/r.h:3,
                 from ./Demo/r.cxx:1:
Include/CXX_Objects.h:1229: Internal compiler error.
Include/CXX_Objects.h:1229: Please submit a full bug report to
`egcs-bugs@egcs.cygnus.com'.
Include/CXX_Objects.h:1229: See
<URL: http://egcs.cygnus.com/faq.html#bugreport > for details.

Cheers

Berthold
-- 
bhoel@starship.python.net
        It is unlawful to use this email address for unsolicited ads
        (USC Title 47 Sec.227). I will assess a US$500 charge for
        reviewing and deleting each unsolicited ad.
r.ii.bz2
r.s.bz2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto_ptr with vector doesn´t compile(gcc-2.95  19990602)
  1999-06-30 23:07 auto_ptr with vector doesn´t compile (gcc-2.95 19990602) Marcel Ruff
  1999-06-05 10:01 ` Gabriel Dos_Reis
@ 1999-06-05 10:53 ` Martin v. Loewis
  1999-06-05 11:02   ` auto_ptr with vector doesn´t compile(gcc-2.95 19990602) - OK, my wrong assumption! Marcel Ruff
  1 sibling, 1 reply; 4+ messages in thread
From: Martin v. Loewis @ 1999-06-05 10:53 UTC (permalink / raw)
  To: mr; +Cc: egcs-bugs

> i believe the following little code is correct, but it wont compile
> (Linux glibc,  gcc-2.95 19990602)
[...]
>  typedef auto_ptr<string> StringP;
>  typedef vector<StringP> MyVector;

Your code is incorrect. You must not build vectors of auto_ptr, since
they don't meet the CopyConstructable and Assignable properties of the
Standard Library container elements (ISO C++, [lib.auto.ptr]/3).

Regards,
Martin


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: auto_ptr with vector doesn´t compile(gcc-2.95 19990602) - OK, my wrong assumption!
  1999-06-05 10:53 ` auto_ptr with vector doesn´t compile(gcc-2.95 19990602) Martin v. Loewis
@ 1999-06-05 11:02   ` Marcel Ruff
  0 siblings, 0 replies; 4+ messages in thread
From: Marcel Ruff @ 1999-06-05 11:02 UTC (permalink / raw)
  To: egcs-bugs

"Martin v. Loewis" wrote:

> > i believe the following little code is correct, but it wont compile
> > (Linux glibc,  gcc-2.95 19990602)
> [...]
> >  typedef auto_ptr<string> StringP;
> >  typedef vector<StringP> MyVector;
>
> Your code is incorrect. You must not build vectors of auto_ptr, since
> they don't meet the CopyConstructable and Assignable properties of the
> Standard Library container elements (ISO C++, [lib.auto.ptr]/3).
>
> Regards,
> Martin
>
> \x01\x01\x01\x01

Thanks Martin and Gabriel

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* auto_ptr with vector doesn´t compile (gcc-2.95 19990602)
@ 1999-06-30 23:07 Marcel Ruff
  1999-06-05 10:01 ` Gabriel Dos_Reis
  1999-06-05 10:53 ` auto_ptr with vector doesn´t compile(gcc-2.95 19990602) Martin v. Loewis
  0 siblings, 2 replies; 4+ messages in thread
From: Marcel Ruff @ 1999-06-30 23:07 UTC (permalink / raw)
  To: egcs-bugs

Hi,

i believe the following little code is correct, but it wont compile
(Linux glibc,  gcc-2.95 19990602)

---------------- CODE -------------
// autoptr.C
#include <memory>
#include <string>
#include <vector>
using namespace std;
int main( int argc, char **argv )
{
 typedef auto_ptr<string> StringP;
 typedef vector<StringP> MyVector;
 StringP ptr(new string("Hello"));
 MyVector vec;
 vec.push_back(ptr);
}
---------------- CODE END ----------

the push_back() expects a const argument, and some internal code doesnt
like the const argument.
It only happens if i use an auto_ptr as argument for push_back()

Thanks for any help

Marcel (please respond to my email adress as well)


Here is the compiler   output:
------------------
marcel@marcel:~> g++ --verbose -o autoptr autoptr.C
Reading specs from
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/specs
gcc version gcc-2.95 19990602 (prerelease)
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/cpp -lang-c++ -v
-D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__
-Dunix -D__i386__ -Dlinux -D
__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux
-Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386
-D__i386 -D__i386__ -Di586 -Dpentium -D
__i586 -D__i586__ -D__pentium -D__pentium__ autoptr.cpp /tmp/ccThfaaa.ii

GNU CPP version gcc-2.95 19990602 (prerelease) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2

 /usr/local/include
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../i586-pc-linux-gnu/include

 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/include
 /usr/include
End of search list.
The following default directories have been omitted from the search
path:
End of omitted list.
 /usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/cc1plus
/tmp/ccThfaaa.ii -quiet -dumpbase autoptr.cc -version -o /tmp/ccCpkaaa.s

GNU C++ version gcc-2.95 19990602 (prerelease) (i586-pc-linux-gnu)
compiled by GNU C version gcc-2.95 19990602 (prerelease).
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/stl_construct.h:
In function `void construct<main(int, char **)::StringP,
auto_ptr<basic_s
tring<char,string_char_traits<char>,__default_alloc_template<true,0> > >
>(main(int, char **)::StringP *, const
auto_ptr<basic_string<char,string_char_traits<char>,__
default_alloc_template<true,0> > > &)':
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/stl_vector.h:321:
instantiated from `vector<auto_ptr<basic_string<char,string_char_trait
s<char>,__default_alloc_template<true,0> >
>,allocator<auto_ptr<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
> > > >::push_back(const m
ain(int, char **)::StringP &)'
autoptr.cpp:11:   instantiated from here
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/stl_construct.h:48:
conversion from `const auto_ptr<basic_string<char,string_char_traits<c
har>,__default_alloc_template<true,0> > >' to
`auto_ptr<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
> > &' discards qualifiers
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/memory:37:
in passing argument 1 of
`auto_ptr<basic_string<char,string_char_traits<char>,_
_default_alloc_template<true,0> >
>::auto_ptr(auto_ptr<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
> > &)'
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/stl_vector.h:
In method `void
vector<auto_ptr<basic_string<char,string_char_traits<char>,_
_default_alloc_template<true,0> >
>,allocator<auto_ptr<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
> > > >::_M_insert_aux(main(int, ch
ar **)::StringP *, const main(int, char **)::StringP &)':
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/stl_vector.h:325:
instantiated from here
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/stl_vector.h:593:
conversion from `const auto_ptr<basic_string<char,string_char_traits<cha

r>,__default_alloc_template<true,0> > >' to
`auto_ptr<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
> > &' discards qualifiers
/usr/local/lib/gcc-lib/i586-pc-linux-gnu/gcc-2.95/../../../../include/g++-2/memory:37:
in passing argument 1 of
`auto_ptr<basic_string<char,string_char_traits<char>,_
_default_alloc_template<true,0> >
>::auto_ptr(auto_ptr<basic_string<char,string_char_traits<char>,__default_alloc_template<true,0>
> > &)'







^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-06-30 23:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-30 23:07 auto_ptr with vector doesn´t compile (gcc-2.95 19990602) Marcel Ruff
1999-06-05 10:01 ` Gabriel Dos_Reis
1999-06-05 10:53 ` auto_ptr with vector doesn´t compile(gcc-2.95 19990602) Martin v. Loewis
1999-06-05 11:02   ` auto_ptr with vector doesn´t compile(gcc-2.95 19990602) - OK, my wrong assumption! Marcel Ruff

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).