From 8970217941625648851
X-Google-Thread: f78e5,51456c3eb8f9490e
X-Google-Attributes: gidf78e5,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: g2news2.google.com!news1.google.com!news4.google.com!news.glorb.com!news.alt.net!comp-std-cpp-robomod!not-for-mail
From: "mark" <markw65@gmail.com>
Newsgroups: comp.std.c++
Subject: Re: Copy Constructor Confusion!
Date: Wed, 16 Aug 2006 11:22:36 CST
Organization: http://groups.google.com
Lines: 40
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <1155663179.843769.44420@b28g2000cwb.googlegroups.com>
References: <1155645873.296811.3890@74g2000cwt.googlegroups.com>
   <hPkEg.12700$j7.324766@news.indigo.ie>
   <ebsor6$jbq$1@news.datemas.de>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
X-Trace: posting.google.com 1155663184 21949 127.0.0.1 (15 Aug 2006 17:33:04 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Tue, 15 Aug 2006 17:33:04 +0000 (UTC)
Return-Path: <devnull@stump.algebra.com>
X-Authentication-Warning: mulga.csse.unimelb.edu.au: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Original-To: std-c++@mailman.ucar.edu
Delivered-To: std-c++@mailman.ucar.edu
User-Agent: G2/0.2
X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5.0.6,gzip(gfe),gzip(gfe)
Complaints-To: groups-abuse@google.com
Injection-Info: b28g2000cwb.googlegroups.com; posting-host=207.135.74.34;
   posting-account=kmJZpwwAAADTaEqNJ8z_rfhCwbaAxYpY
X-Virus-Scanned: amavisd-new at ucar.edu
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
X-Virus-Scanned: amavisd-new at csse.unimelb.edu.au
Xref: g2news2.google.com comp.std.c++:3303


"Victor Bazarov" wrote:
> Shouldn't this be moved to a .lang. newsgroup?  Just checking...
>
> Frederick Gotham wrote:
> > Thomas posted:
> >
> >> Hello fellow programmers!
> >>
> >> I have a c++ line:
> >>
> >> X x = X();
> >>
> >> Does the standard say that the class X must have a public copy
> >> constructor for this to be legal, even if the copy constructor never
> >> gets called?
> >
> >
> > Yes, although it gives explicit permission to the compiler to elide
> > the creation of the redudant temporary object. Even if the temporary
> > is elided, the copy-constructor must still be public.
>
> Not "public", *accessible*.  If the "c++ line" above appears inside
> a friend function, it would work just fine with a private copy c-tor.

Yes.

> If it appears inside a member of a derived class, "protected" should
> suffice.

Really?

Mark Williams

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]



