This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Is it a bug (gcc 3.4)?
- From: llewelly at xmission dot com
- To: "Lev Assinovsky" <LAssinovsky at algorithm dot aelita dot com>
- Cc: "Gcc-Help \(E-mail\)" <gcc-help at gcc dot gnu dot org>
- Date: 10 Jun 2004 13:34:47 -0600
- Subject: Re: Is it a bug (gcc 3.4)?
- References: <A791774B798C024D98F7E10961E99E71278993@SPBMX0.edm.com>
"Lev Assinovsky" <LAssinovsky@algorithm.aelita.com> writes:
> Hi all!
> With auto_ptr from gcc 3.4 STL I can't create reference to auto_ptr.
>
> autoptr.cpp:
> #include <memory>
> using namespace std;
>
> auto_ptr<int> get() { auto_ptr<int> ai(new int); return ai;}
> int main()
> {
> const auto_ptr<int>& rai = get();
>
> }
>
> Compilation:
> /expor...ic_refer$>g++ -c autoptr.cpp
> autoptr.cpp: In function `int main()':
> autoptr.cpp:7: error: passing `const std::auto_ptr<int>' as `this' argument of `std::auto_ptr<_Tp>::operator std::auto_ptr_ref<_Tp1>()
> [with _Tp1 = int, _Tp = int]' discards qualifiers
como online reports:
"ComeauTest.c", line 7: error: class "std::auto_ptr<int>" has no
suitable copy
constructor
const auto_ptr<int>& rai = get();
>
> Is it a bug?
> It used to work with gcc 3.2.
It also works with gcc 3.3.3 . Could you repost this in a forum like
comp.lang.c++.moderated, and start a discussion about whether or not
the code is well-formed?