diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 6de5bbbd2e6..36c45b5125e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,13 @@ +2013-03-17 Paolo Carlini + + 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 PR c++/55017 diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index cc6edb3da7f..596760c2152 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 00000000000..6a069bfd7e3 --- /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 +// . + +#include + +struct A +{ + A(int) { } + A(const A&) = delete; + A& operator=(const A&) = delete; +}; + +void foo() +{ + int i[] = {1, 2}; + std::list 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 326df4b43ee..1e7767b4bee 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 1fc5dfb47a5..63216cb01c8 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 @@ // . // { dg-do compile } -// { dg-error "no matching" "" { target *-*-* } 1525 } +// { dg-error "no matching" "" { target *-*-* } 1529 } #include