This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34180] Default copy constructor copies const auto_ptr members
- From: "pcarlini at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 22 Nov 2007 00:10:19 -0000
- Subject: [Bug c++/34180] Default copy constructor copies const auto_ptr members
- References: <bug-34180-15406@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from pcarlini at suse dot de 2007-11-22 00:10 -------
(In reply to comment #3)
> (In reply to comment #2)
> > I think this is the issue, nothing specific to std::auto_ptr:
> >
> > struct G { G() { } G(G&) { } };
> >
> > int main()
> > {
> > class A
> > {
> > const G g;
> > };
> > A a;
> > A b = a;
> > }
> >
>
> No, copying of const values is certainly allowed:
>
> const int i = 5;
> const int i2 = i; //SHOULD compile
>
> Your struct G can also be created and copied:
>
> G g;
> G g2 = g;
Of course, and of course. But that has nothing to do with my reduced snippet,
which is equivalent to our standard-conforming implementation of std::auto_ptr,
as far as I can see, and, does compile, whereas it should not - to be clear, I
think you are therefore right, just there is nothing wrong with our
implementation of std::auto_ptr, if anything, this is a front-end issue. By the
way, ICC rejects my reduced snippet.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34180