From patchwork Sat Mar 31 01:55:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Carlini X-Patchwork-Id: 149807 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AA280B6FCA for ; Sat, 31 Mar 2012 12:59:14 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1333763955; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Message-ID:Date:From:User-Agent:MIME-Version: To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=2xhXmkg0Pc/vzf4NuDgP09rzbm8=; b=eUvNR4QGgt5eUB6 6m41BA0RI7dOmwfjJvu4eHEA2H0GN0J/1HR5h0fCZQBUNmQQanbY+YoZNPOvN8oE uaSJt2/Dx8XC+Dy4SCvIlTkhmsqb5Qx9RotKrnCqwCv2HHCihCTqdk747/Y0nL5y LSqpH+OA3aSSrR2cRlpkPD9Nyt/0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=PKRrEsvDvY4HpHqWZ4CXxG0IrDZxxD5AxYU9v0gxAjk8Qw9FPeVGXL97cj3pYe bFo1aBlha6KFytQ3oJy2jiqEP2qpTxrZU1jSEnEagXdbbEZxf8IPrFf1vQ5ibnM+ nBp2mZgKYF1CPRZ7iW09w2Eqs8G0pMDSNEyAU3CnQanic=; Received: (qmail 14764 invoked by alias); 31 Mar 2012 01:59:03 -0000 Received: (qmail 14678 invoked by uid 22791); 31 Mar 2012 01:59:01 -0000 X-SWARE-Spam-Status: No, hits=-6.1 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from rcsinet15.oracle.com (HELO rcsinet15.oracle.com) (148.87.113.117) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 31 Mar 2012 01:58:45 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q2V1wiYv018155 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 31 Mar 2012 01:58:45 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q2V1wbaR011420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 31 Mar 2012 01:58:41 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q2V1wbUi011955; Fri, 30 Mar 2012 20:58:37 -0500 Received: from [192.168.1.4] (/79.52.240.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 Mar 2012 18:58:37 -0700 Message-ID: <4F76640D.6070007@oracle.com> Date: Sat, 31 Mar 2012 03:55:25 +0200 From: Paolo Carlini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120312 Thunderbird/11.0 MIME-Version: 1.0 To: "gcc-patches@gcc.gnu.org" CC: libstdc++ Subject: [v3] Fix libstdc++/52799 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi, tested x86_64-linux, committed mainline and 4_7-branch. Thanks, Paolo. /////////////////////////////// 2012-03-30 Jeffrey Yasskin Paolo Carlini PR libstdc++/52799 * include/bits/deque.tcc (emplace): Fix thinko, replace push_front -> emplace_front, and likewise for *_back. * testsuite/23_containers/deque/modifiers/emplace/52799.cc: New. * testsuite/23_containers/list/modifiers/emplace/52799.cc: Likewise. * testsuite/23_containers/vector/modifiers/emplace/52799.cc: Likewise. Index: include/bits/deque.tcc =================================================================== --- include/bits/deque.tcc (revision 185982) +++ include/bits/deque.tcc (working copy) @@ -1,7 +1,7 @@ // Deque implementation (out of line) -*- C++ -*- // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, -// 2009, 2010, 2011 +// 2009, 2010, 2011, 2012 // Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -175,12 +175,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { if (__position._M_cur == this->_M_impl._M_start._M_cur) { - push_front(std::forward<_Args>(__args)...); + emplace_front(std::forward<_Args>(__args)...); return this->_M_impl._M_start; } else if (__position._M_cur == this->_M_impl._M_finish._M_cur) { - push_back(std::forward<_Args>(__args)...); + emplace_back(std::forward<_Args>(__args)...); iterator __tmp = this->_M_impl._M_finish; --__tmp; return __tmp; Index: testsuite/23_containers/vector/modifiers/emplace/52799.cc =================================================================== --- testsuite/23_containers/vector/modifiers/emplace/52799.cc (revision 0) +++ testsuite/23_containers/vector/modifiers/emplace/52799.cc (revision 0) @@ -0,0 +1,28 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// libstdc++/52799 +int main() +{ + std::vector v; + v.emplace(v.begin()); +} Index: testsuite/23_containers/deque/modifiers/emplace/52799.cc =================================================================== --- testsuite/23_containers/deque/modifiers/emplace/52799.cc (revision 0) +++ testsuite/23_containers/deque/modifiers/emplace/52799.cc (revision 0) @@ -0,0 +1,28 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// libstdc++/52799 +int main() +{ + std::deque d; + d.emplace(d.begin()); +} Index: testsuite/23_containers/list/modifiers/emplace/52799.cc =================================================================== --- testsuite/23_containers/list/modifiers/emplace/52799.cc (revision 0) +++ testsuite/23_containers/list/modifiers/emplace/52799.cc (revision 0) @@ -0,0 +1,28 @@ +// { dg-options "-std=gnu++11" } +// { dg-do compile } + +// Copyright (C) 2012 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// . + +#include + +// libstdc++/52799 +int main() +{ + std::list l; + l.emplace(l.begin()); +}