diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2013-03-17 18:27:52 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2013-03-17 18:27:52 +0000 |
commit | b4904956fad37473e178ef573049536ba87c4462 (patch) | |
tree | bb338242bd139b637ef0753eea81d49714bbc18e | |
parent | 9f4f1735d8b1200b5dbdb86e574c62aa5540cf11 (diff) | |
download | gcc-b4904956fad37473e178ef573049536ba87c4462.zip gcc-b4904956fad37473e178ef573049536ba87c4462.tar.gz gcc-b4904956fad37473e178ef573049536ba87c4462.tar.bz2 |
re PR libstdc++/55979 ([C++11] std::list range construction imposes unnecessary conversion constraints)
2013-03-17 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/55979
* include/bits/stl_list.h (_M_initialize_dispatch(_InputIterator,
_InputIterator, __false_type)): Use emplace_back.
* testsuite/23_containers/list/cons/55979.cc: New.
* testsuite/23_containers/list/modifiers/1.h: Adjust.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
From-SVN: r196755
-rw-r--r-- | libstdc++-v3/ChangeLog | 10 | ||||
-rw-r--r-- | libstdc++-v3/include/bits/stl_list.h | 4 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/list/cons/55979.cc | 34 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/list/modifiers/1.h | 12 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc | 2 |
5 files changed, 61 insertions, 1 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6de5bbb..36c45b5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2013-03-17 Paolo Carlini <paolo.carlini@oracle.com> + + PR libstdc++/55979 + * include/bits/stl_list.h (_M_initialize_dispatch(_InputIterator, + _InputIterator, __false_type)): Use emplace_back. + * testsuite/23_containers/list/cons/55979.cc: New. + * testsuite/23_containers/list/modifiers/1.h: Adjust. + * testsuite/23_containers/list/requirements/dr438/assign_neg.cc: + Adjust dg-error line number. + 2013-03-16 Jason Merrill <jason@redhat.com> PR c++/55017 diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index cc6edb3d..596760c 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -1487,7 +1487,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __false_type) { for (; __first != __last; ++__first) +#if __cplusplus >= 201103L + emplace_back(*__first); +#else push_back(*__first); +#endif } // Called by list(n,v,a), and the range constructor when it turns out diff --git a/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc b/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc new file mode 100644 index 0000000..6a069bf --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/cons/55979.cc @@ -0,0 +1,34 @@ +// { dg-do compile } +// { dg-options "-std=gnu++11" } + +// Copyright (C) 2013 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 +// <http://www.gnu.org/licenses/>. + +#include <list> + +struct A +{ + A(int) { } + A(const A&) = delete; + A& operator=(const A&) = delete; +}; + +void foo() +{ + int i[] = {1, 2}; + std::list<A> li(i, i + 2); +} diff --git a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h index 326df4b..1e7767b 100644 --- a/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h +++ b/libstdc++-v3/testsuite/23_containers/list/modifiers/1.h @@ -89,14 +89,22 @@ modifiers1() b = list0301.begin(); list0301.insert(b, A, A + N); // should be [321 322 333 13 13] VERIFY(list0301.size() == 5); +#if __cplusplus >= 201103L + VERIFY(copy_constructor::count() == 0); +#else VERIFY(copy_constructor::count() == 3); +#endif VERIFY(m->id() == 13); // range fill at end value_type::reset(); list0301.insert(e, A, A + N); // should be [321 322 333 13 13 321 322 333] VERIFY(list0301.size() == 8); +#if __cplusplus >= 201103L + VERIFY(copy_constructor::count() == 0); +#else VERIFY(copy_constructor::count() == 3); +#endif VERIFY(e == list0301.end()); VERIFY(m->id() == 13); @@ -104,7 +112,11 @@ modifiers1() value_type::reset(); list0301.insert(m, A, A + N); VERIFY(list0301.size() == 11); +#if __cplusplus >= 201103L + VERIFY(copy_constructor::count() == 0); +#else VERIFY(copy_constructor::count() == 3); +#endif VERIFY(e == list0301.end()); VERIFY(m->id() == 13); diff --git a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc index 1fc5dfb..63216cb 100644 --- a/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc +++ b/libstdc++-v3/testsuite/23_containers/list/requirements/dr438/assign_neg.cc @@ -18,7 +18,7 @@ // <http://www.gnu.org/licenses/>. // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1525 } +// { dg-error "no matching" "" { target *-*-* } 1529 } #include <list> |