[Bug c++/34180] Default copy constructor copies const auto_ptr members
pcarlini at suse dot de
gcc-bugzilla@gcc.gnu.org
Thu Nov 22 00:10:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list