From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19131 invoked by alias); 28 Apr 2003 22:46:41 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 19111 invoked by uid 48); 28 Apr 2003 22:46:40 -0000 Date: Mon, 28 Apr 2003 22:46:00 -0000 Message-ID: <20030428224640.19110.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, jkanze@caicheuvreuse.com, nobody@gcc.gnu.org, pcarlini@unitus.it From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, jkanze@caicheuvreuse.com, nobody@gcc.gnu.org, pcarlini@unitus.it, gcc-gnats@gcc.gnu.org Subject: Re: c++/10529: C++ front-end troubles with uninitialized_fill_n X-SW-Source: 2003-04/txt/msg01299.txt.bz2 List-Id: Synopsis: C++ front-end troubles with uninitialized_fill_n State-Changed-From-To: open->feedback State-Changed-By: bangerth State-Changed-When: Mon Apr 28 22:46:40 2003 State-Changed-Why: Hm, I'm not sure I understand what is going on. Your code reduces to this: ----------------------- #include class X { public: X(int i); private: X(const X&); }; int main() { std::uninitialized_fill_n( (X*)0, 3, X(2) ) ; } ------------------------- which indeed fails to compile since X has no public copy constructor. However, the draft standard has this wording: 20.4.4.3 uninitialized_fill_n [lib.uninitialized.fill.n] template void uninitialized_fill_n(ForwardIterator first, Size n, const T& x); Effects: while (n--) new (static_cast(&*result++)) typename iterator_traits::value_type(*first++); So it uses placement new to generate a -- well, that seems like a defect, but if we take the respective statement from right above that place (unitialized_fill), it reads new (static_cast(&*first++)) typename iterator_traits::value_type(x); So that would make a copy of x, no? I would say that then we need a public copy constructor. What am I missing? W. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10529