Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #11266
| From | Richard Damon <news.x.richarddamon@xoxy.net> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Odd error I can't seem to recreate |
| Date | 2011-11-04 16:15 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j91h55$idp$1@dont-email.me> (permalink) |
| References | <bbe45080-3e8d-4e2f-aefc-7ac0906a6872@s7g2000yqa.googlegroups.com> <j91fkd$7uo$1@dont-email.me> <16a6d920-6666-496d-b3b2-5d7785a3204d@u28g2000yqb.googlegroups.com> |
On 11/4/11 3:58 PM, Noah Roberts wrote:
> On Nov 4, 12:49 pm, Victor Bazarov<v.baza...@comcast.invalid> wrote:
>> On 11/4/2011 2:52 PM, Noah Roberts wrote:
>
>>> The bool constructor is made by me, but the non-const copy constructor
>>> is the compiler's.
>>
>> What??? Why would the compiler create a non-const copy c-tor? Or,
>> rather, what have you done to tell it to create that particular form of
>> the copy c-tor?
>>
>
> Yes, that bothers me a great deal as well, but for some reason g++
> seems to be making non-const copy constructors by default. Here's the
> class declarations:
>
...
> struct test_service : location_service
> {
>
> // overrides of inherited virtuals...
>
> test_service();
> test_service(bool sleeper);
> ~test_service();
> private:
> struct impl;
> std::auto_ptr<impl> pimpl;
> };
>
> No declaration of copy constructor anywhere. It's not the first time
> I've seen it and I'm assuming it's some sort of quirk/bug in g++
> 4.1.2.
>
Note that auto_ptr has a non-const copy constructor, as copying an
auto_ptr changes the source auto pointer. Therefore any class that has
an auto_ptr member will by default have a non-const copy constructor, as
it can't make a const copy constructor.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 11:52 -0700
Re: Odd error I can't seem to recreate Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-04 15:49 -0400
Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 12:58 -0700
Re: Odd error I can't seem to recreate Richard Damon <news.x.richarddamon@xoxy.net> - 2011-11-04 16:15 -0400
Re: Odd error I can't seem to recreate "Gennaro Prota" <gennaro.prota@gmail.com> - 2011-11-04 21:03 +0100
Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 13:07 -0700
Re: Odd error I can't seem to recreate Victor Bazarov <v.bazarov@comcast.invalid> - 2011-11-04 16:43 -0400
Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 13:56 -0700
Re: Odd error I can't seem to recreate "Gennaro Prota" <name.surname@gmail.com> - 2011-11-04 22:16 +0100
Re: Odd error I can't seem to recreate "Gennaro Prota" <gennaro.prota@gmail.com> - 2011-11-04 21:16 +0100
Re: Odd error I can't seem to recreate Noah Roberts <roberts.noah@gmail.com> - 2011-11-04 13:15 -0700
Re: Odd error I can't seem to recreate Ian Collins <ian-news@hotmail.com> - 2011-11-05 12:00 +1300
Re: Odd error I can't seem to recreate "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2011-11-05 18:48 +0100
Re: Odd error I can't seem to recreate "Gennaro Prota" <name.surname@gmail.com> - 2011-11-05 22:35 +0100
csiph-web