public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’
@ 2013-11-19 16:04 olaf--mail.gcc at olafdietsche dot de
  2013-11-19 16:44 ` [Bug libstdc++/59192] " paolo.carlini at oracle dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: olaf--mail.gcc at olafdietsche dot de @ 2013-11-19 16:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

            Bug ID: 59192
           Summary: error: use of deleted function ‘A::A(const A&)’
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: olaf--mail.gcc at olafdietsche dot de

Created attachment 31250
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31250&action=edit
Generated with g++-4.7 -v -save-temps -c -Wall -std=c++11 a.cpp

The following snippet compiles fine with g++ 4.6 and fails with g++ 4.7 or g++
4.8 

#include <deque>
#include <vector>

struct A {
    A(const A&) = delete;
};

void f()
{
    std::vector<std::deque<A> > q;
    q.resize(4);
}

I attached the preprocessed file. If I missed a necessary part, please let
know.
System is Ubuntu 12.04

g++-4.7 -c -Wall -std=c++11 a.cpp
In file included from /usr/include/c++/4.7/deque:63:0,
                 from a.cpp:1:
/usr/include/c++/4.7/bits/stl_construct.h: In instantiation of ‘void
std::_Construct(_T1*, _Args&& ...) [with _T1 = A; _Args = {const A&}]’:
/usr/include/c++/4.7/bits/stl_uninitialized.h:77:3:   required from ‘static
_ForwardIterator
std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator,
_InputIterator, _ForwardIterator) [with _InputIterator =
std::_Deque_iterator<A, const A&, const A*>; _ForwardIterator =
std::_Deque_iterator<A, A&, A*>; bool _TrivialValueTypes = false]’
/usr/include/c++/4.7/bits/stl_uninitialized.h:119:41:   required from
‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator,
_ForwardIterator) [with _InputIterator = std::_Deque_iterator<A, const A&,
const A*>; _ForwardIterator = std::_Deque_iterator<A, A&, A*>]’
/usr/include/c++/4.7/bits/stl_uninitialized.h:260:63:   required from
‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator,
_ForwardIterator, std::allocator<_Tp>&) [with _InputIterator =
std::_Deque_iterator<A, const A&, const A*>; _ForwardIterator =
std::_Deque_iterator<A, A&, A*>; _Tp = A]’
/usr/include/c++/4.7/bits/stl_deque.h:841:9:   required from ‘std::deque<_Tp,
_Alloc>::deque(const std::deque<_Tp, _Alloc>&) [with _Tp = A; _Alloc =
std::allocator<A>; std::deque<_Tp, _Alloc> = std::deque<A>]’
/usr/include/c++/4.7/bits/stl_construct.h:77:7:   required from ‘void
std::_Construct(_T1*, _Args&& ...) [with _T1 = std::deque<A>; _Args =
{std::deque<A, std::allocator<A> >&}]’
/usr/include/c++/4.7/bits/stl_uninitialized.h:77:3:   required from ‘static
_ForwardIterator
std::__uninitialized_copy<_TrivialValueTypes>::__uninit_copy(_InputIterator,
_InputIterator, _ForwardIterator) [with _InputIterator = std::deque<A>*;
_ForwardIterator = std::deque<A>*; bool _TrivialValueTypes = false]’
/usr/include/c++/4.7/bits/stl_uninitialized.h:119:41:   required from
‘_ForwardIterator std::uninitialized_copy(_InputIterator, _InputIterator,
_ForwardIterator) [with _InputIterator = std::deque<A>*; _ForwardIterator =
std::deque<A>*]’
/usr/include/c++/4.7/bits/stl_uninitialized.h:260:63:   required from
‘_ForwardIterator std::__uninitialized_copy_a(_InputIterator, _InputIterator,
_ForwardIterator, std::allocator<_Tp>&) [with _InputIterator = std::deque<A>*;
_ForwardIterator = std::deque<A>*; _Tp = std::deque<A>]’
/usr/include/c++/4.7/bits/stl_uninitialized.h:283:69:   required from
‘_ForwardIterator std::__uninitialized_move_if_noexcept_a(_InputIterator,
_InputIterator, _ForwardIterator, _Allocator&) [with _InputIterator =
std::deque<A>*; _ForwardIterator = std::deque<A>*; _Allocator =
std::allocator<std::deque<A> >]’
/usr/include/c++/4.7/bits/vector.tcc:554:5:   required from ‘void
std::vector<_Tp, _Alloc>::_M_default_append(std::vector<_Tp,
_Alloc>::size_type) [with _Tp = std::deque<A>; _Alloc =
std::allocator<std::deque<A> >; std::vector<_Tp, _Alloc>::size_type = long
unsigned int]’
/usr/include/c++/4.7/bits/stl_vector.h:647:4:   required from ‘void
std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp
= std::deque<A>; _Alloc = std::allocator<std::deque<A> >; std::vector<_Tp,
_Alloc>::size_type = long unsigned int]’
a.cpp:11:15:   required from here
/usr/include/c++/4.7/bits/stl_construct.h:77:7: error: use of deleted function
‘A::A(const A&)’
a.cpp:5:5: error: declared here


g++-4.7 -v
Using built-in specs.
COLLECT_GCC=g++-4.7
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.7.3-1ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --enable-objc-gc --with-cloog --enable-cloog-backend=ppl
--disable-cloog-version-check --disable-ppl-version-check --enable-multiarch
--disable-werror --with-arch-32=i686 --with-abi=m64
--with-multilib-list=m32,m64,mx32 --with-tune=generic --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.3 (Ubuntu/Linaro 4.7.3-1ubuntu1)
>From gcc-bugs-return-435092-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Nov 19 16:05:27 2013
Return-Path: <gcc-bugs-return-435092-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 31727 invoked by alias); 19 Nov 2013 16:05:27 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 31702 invoked by uid 48); 19 Nov 2013 16:05:24 -0000
From: "mtewoodbury at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/59193] New: Unused postfix operator temporaries
Date: Tue, 19 Nov 2013 16:05:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: new
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: c
X-Bugzilla-Version: unknown
X-Bugzilla-Keywords:
X-Bugzilla-Severity: minor
X-Bugzilla-Who: mtewoodbury at gmail dot com
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter
Message-ID: <bug-59193-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2013-11/txt/msg01869.txt.bz2
Content-length: 1025

http://gcc.gnu.org/bugzilla/show_bug.cgi?idY193

            Bug ID: 59193
           Summary: Unused postfix operator temporaries
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mtewoodbury at gmail dot com

The use of postfix operators without using the value in their inherent
temporary store is a mild abuse of languages that provide those operators.
Compilers convert them to prefix operators as part of their optimization
process, but they waste space in automatic storage when the optimization is
insufficiently deep to detect them.

Reading the code in this project turns up hundreds of instances of this poor
practice.  Please convert these to the proper prefix operator form.

(More to the point, please accept patches that fix these problems without
abuse!  I have several sets that I will submit if there are no strong
objections.)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
@ 2013-11-19 16:44 ` paolo.carlini at oracle dot com
  2013-11-19 17:25 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-11-19 16:44 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
I suspect this may be pretty hard to fix until std::deque gets a noexcept move
constructor. 4.6.x simply didn't have move_if_noexcept.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
  2013-11-19 16:44 ` [Bug libstdc++/59192] " paolo.carlini at oracle dot com
@ 2013-11-19 17:25 ` redi at gcc dot gnu.org
  2014-01-05 20:50 ` rajveer_aujla at hotmail dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2013-11-19 17:25 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It will get fixed when adding C++11 allocator support to std::deque, which is
in progress but not ready.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
  2013-11-19 16:44 ` [Bug libstdc++/59192] " paolo.carlini at oracle dot com
  2013-11-19 17:25 ` redi at gcc dot gnu.org
@ 2014-01-05 20:50 ` rajveer_aujla at hotmail dot com
  2014-01-05 21:04 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rajveer_aujla at hotmail dot com @ 2014-01-05 20:50 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

--- Comment #4 from Rajveer Aujla <rajveer_aujla at hotmail dot com> ---
Is there a timeline/GCC version planned for when C++11 allocator support will
be added to std::deque? I don't mean to sound pushy, just wondering if it's
worth me recoding the part of my project that relies on it.

I noticed that you wrote a WIP patch for it linked below, is this reliable
enough to be used for now?

http://gcc.1065356.n5.nabble.com/WIP-C-11-allocator-support-for-std-deque-td987696.html


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
                   ` (2 preceding siblings ...)
  2014-01-05 20:50 ` rajveer_aujla at hotmail dot com
@ 2014-01-05 21:04 ` redi at gcc dot gnu.org
  2014-01-07 14:21 ` rajveer_aujla at hotmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-01-05 21:04 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
It should be done for GCC 5.0

The WIP patch is not reliable.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
                   ` (3 preceding siblings ...)
  2014-01-05 21:04 ` redi at gcc dot gnu.org
@ 2014-01-07 14:21 ` rajveer_aujla at hotmail dot com
  2014-09-19 11:09 ` redi at gcc dot gnu.org
  2015-09-03 10:28 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rajveer_aujla at hotmail dot com @ 2014-01-07 14:21 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

--- Comment #6 from Rajveer Aujla <rajveer_aujla at hotmail dot com> ---
Thank you for the quick reply. Looking at release dates of previous releases,
I'm guessing this will be earliest around next year? Looks like I'd better get
coding a workaround :)


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
                   ` (4 preceding siblings ...)
  2014-01-07 14:21 ` rajveer_aujla at hotmail dot com
@ 2014-09-19 11:09 ` redi at gcc dot gnu.org
  2015-09-03 10:28 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2014-09-19 11:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
GCC's std::deque now meets the C++11 allocator requirements, but still doesn't
have a noexcept move constructor so the example in this PR still doesn't
compile (which is conforming behaviour, the standard says the example is
invalid).


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/59192] error: use of deleted function ‘A::A(const A&)’
  2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
                   ` (5 preceding siblings ...)
  2014-09-19 11:09 ` redi at gcc dot gnu.org
@ 2015-09-03 10:28 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-03 10:28 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59192

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |WONTFIX

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
As stated above, there is no way to fix this right now, and the current
behaviour is allowed by the standard.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-03 10:28 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-19 16:04 [Bug c++/59192] New: error: use of deleted function ‘A::A(const A&)’ olaf--mail.gcc at olafdietsche dot de
2013-11-19 16:44 ` [Bug libstdc++/59192] " paolo.carlini at oracle dot com
2013-11-19 17:25 ` redi at gcc dot gnu.org
2014-01-05 20:50 ` rajveer_aujla at hotmail dot com
2014-01-05 21:04 ` redi at gcc dot gnu.org
2014-01-07 14:21 ` rajveer_aujla at hotmail dot com
2014-09-19 11:09 ` redi at gcc dot gnu.org
2015-09-03 10:28 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).