public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/63274] New: std::list uses T(...) instead of T{...} in implementation of emplace()
@ 2014-09-16 5:34 d.v.a at ngs dot ru
2014-09-16 8:22 ` [Bug libstdc++/63274] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: d.v.a at ngs dot ru @ 2014-09-16 5:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63274
Bug ID: 63274
Summary: std::list uses T(...) instead of T{...} in
implementation of emplace()
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: d.v.a at ngs dot ru
Example:
#include<list>
struct C { int a, b; };
int main()
{
std::list<C> l;
l.emplace_back(1, 2);
}
$ g++ -std=c++11 -Wall example.cpp
In file included from /opt/gcc-4.9.0/include/c++/4.9.0/list:63:0,
from /tmp/gcc-explorer-compiler114816-7339-16y749p/example.cpp:1:
/opt/gcc-4.9.0/include/c++/4.9.0/bits/stl_list.h: In instantiation of
‘std::_List_node<_Tp>::_List_node(_Args&& ...) [with _Args = {int, int}; _Tp =
C]’:
/opt/gcc-4.9.0/include/c++/4.9.0/ext/new_allocator.h:120:4: required from ‘void
__gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up =
std::_List_node<C>; _Args = {int, int}; _Tp = std::_List_node<C>]’
/opt/gcc-4.9.0/include/c++/4.9.0/bits/stl_list.h:514:8: required from
‘std::list<_Tp, _Alloc>::_Node* std::list<_Tp, _Alloc>::_M_create_node(_Args&&
...) [with _Args = {int, int}; _Tp = C; _Alloc = std::allocator<C>;
std::list<_Tp, _Alloc>::_Node = std::_List_node<C>]’
/opt/gcc-4.9.0/include/c++/4.9.0/bits/stl_list.h:1688:63: required from ‘void
std::list<_Tp, _Alloc>::_M_insert(std::list<_Tp, _Alloc>::iterator, _Args&&
...) [with _Args = {int, int}; _Tp = C; _Alloc = std::allocator<C>;
std::list<_Tp, _Alloc>::iterator = std::_List_iterator<C>]’
/opt/gcc-4.9.0/include/c++/4.9.0/bits/stl_list.h:1039:11: required from ‘void
std::list<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {int, int}; _Tp
= C; _Alloc = std::allocator<C>]’
8 : required from here
/opt/gcc-4.9.0/include/c++/4.9.0/bits/stl_list.h:114:71: error: no matching
function for call to ‘C::C(int, int)’
: __detail::_List_node_base(), _M_data(std::forward<_Args>(__args)...)
^
/opt/gcc-4.9.0/include/c++/4.9.0/bits/stl_list.h:114:71: note: candidates are:
3 : note: C::C()
struct C { int a, b; };
^
3 : note: candidate expects 0 arguments, 2 provided
3 : note: constexpr C::C(const C&)
3 : note: candidate expects 1 argument, 2 provided
3 : note: constexpr C::C(C&&)
3 : note: candidate expects 1 argument, 2 provided
Compilation failed
I suppose it should work without defining constructor for C.
>From gcc-bugs-return-461853-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Sep 16 05:39:40 2014
Return-Path: <gcc-bugs-return-461853-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 14446 invoked by alias); 16 Sep 2014 05:39:40 -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 14427 invoked by uid 48); 16 Sep 2014 05:39:35 -0000
From: "d.v.a at ngs dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/63274] std::list uses T(...) instead of T{...} in implementation of emplace()
Date: Tue, 16 Sep 2014 05:39:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.9.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: d.v.a at ngs dot ru
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:
Message-ID: <bug-63274-4-UUL4MG9DpK@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-63274-4@http.gcc.gnu.org/bugzilla/>
References: <bug-63274-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: 2014-09/txt/msg01687.txt.bz2
Content-length: 222
https://gcc.gnu.org/bugzilla/show_bug.cgi?idc274
--- Comment #1 from __vic <d.v.a at ngs dot ru> ---
And yes, in this case I can just write
l.push_back({1, 2});
But both cases should be acceptable for compiler, IMO.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-16 8:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-16 5:34 [Bug libstdc++/63274] New: std::list uses T(...) instead of T{...} in implementation of emplace() d.v.a at ngs dot ru
2014-09-16 8:22 ` [Bug libstdc++/63274] " 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).