re PR libstdc++/58764 ([lwg/2193] error: converting to ‘const std::vector<std::basic_string<char> >’ from initializer list would use explicit constructor)

PR libstdc++/58764
	* include/bits/stl_deque.h (deque::deque(const allocator_type&):
	Split into separate default constructor and constructor taking
	allocator.
	* include/bits/stl_list.h (list::list(const allocator_type&): Likewise.
	* include/bits/stl_vector.h (vector::vector(const allocator_type&):
	Likewise.
	* include/debug/deque (deque::deque(const allocator_type&)): Likewise.
	* include/debug/list (list::list(const _Allocator&)): Likewise.
	* include/debug/map.h (map::map(const _Compare&, const _Allocator&)):
	Likewise.
	* include/debug/multimap.h
	(multimap::multimap(const _Compare&, const _Allocator&)): Likewise.
	* include/debug/set.h (set::set(const _Compare&, const _Allocator&)):
	Likewise.
	* include/debug/multiset.h
	(multiset::multiset(const _Compare&, const _Allocator&)): Likewise.
	* include/debug/vector (vector::vector(const allocator_type&)):
	Likewise.
	* include/profile/deque (deque::deque(const _Allocator&)): Likewise.
	* include/profile/list (list::list(const _Allocator&)): Likewise.
	* include/profile/map.h
	(map::map(const _Compare&, const _Allocator&)): Likewise.
	* include/profile/multimap.h
	(multimap::multimap(const _Compare&, const _Allocator&)): Likewise.
	* include/profile/set.h
	(set::set(const _Compare&, const _Allocator&)): Likewise.
	* include/profile/multiset.h
	(multiset::multiset(const _Compare&, const _Allocator&)): Likewise.
	* include/profile/vector (vector::vector(const _Allocator&)):
	Likewise.
	* testsuite/23_containers/deque/58764.cc: New.
	* testsuite/23_containers/list/58764.cc: New.
	* testsuite/23_containers/map/58764.cc: New.
	* testsuite/23_containers/multimap/58764.cc: New.
	* testsuite/23_containers/set/58764.cc: New.
	* testsuite/23_containers/multiset/58764.cc: New.
	* testsuite/23_containers/vector/58764.cc: New.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust dg-error line number.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
	Likewise.
	* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
	Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_1_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/
	constructor_2_neg.cc: Likewise.
	* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r206939
This commit is contained in:
Jonathan Wakely 2014-01-22 19:46:44 +00:00 committed by Jonathan Wakely
parent df2980beb3
commit c3cdd71f45
37 changed files with 368 additions and 29 deletions

View File

@ -2,6 +2,69 @@
* include/bits/stl_deque.h (_Deque_impl): Move comment.
PR libstdc++/58764
* include/bits/stl_deque.h (deque::deque(const allocator_type&):
Split into separate default constructor and constructor taking
allocator.
* include/bits/stl_list.h (list::list(const allocator_type&): Likewise.
* include/bits/stl_vector.h (vector::vector(const allocator_type&):
Likewise.
* include/debug/deque (deque::deque(const allocator_type&)): Likewise.
* include/debug/list (list::list(const _Allocator&)): Likewise.
* include/debug/map.h (map::map(const _Compare&, const _Allocator&)):
Likewise.
* include/debug/multimap.h
(multimap::multimap(const _Compare&, const _Allocator&)): Likewise.
* include/debug/set.h (set::set(const _Compare&, const _Allocator&)):
Likewise.
* include/debug/multiset.h
(multiset::multiset(const _Compare&, const _Allocator&)): Likewise.
* include/debug/vector (vector::vector(const allocator_type&)):
Likewise.
* include/profile/deque (deque::deque(const _Allocator&)): Likewise.
* include/profile/list (list::list(const _Allocator&)): Likewise.
* include/profile/map.h
(map::map(const _Compare&, const _Allocator&)): Likewise.
* include/profile/multimap.h
(multimap::multimap(const _Compare&, const _Allocator&)): Likewise.
* include/profile/set.h
(set::set(const _Compare&, const _Allocator&)): Likewise.
* include/profile/multiset.h
(multiset::multiset(const _Compare&, const _Allocator&)): Likewise.
* include/profile/vector (vector::vector(const _Allocator&)):
Likewise.
* testsuite/23_containers/deque/58764.cc: New.
* testsuite/23_containers/list/58764.cc: New.
* testsuite/23_containers/map/58764.cc: New.
* testsuite/23_containers/multimap/58764.cc: New.
* testsuite/23_containers/set/58764.cc: New.
* testsuite/23_containers/multiset/58764.cc: New.
* testsuite/23_containers/vector/58764.cc: New.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust dg-error line number.
* testsuite/23_containers/deque/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
Likewise.
* testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/assign_neg.cc:
Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_1_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/
constructor_2_neg.cc: Likewise.
* testsuite/23_containers/vector/requirements/dr438/insert_neg.cc:
Likewise.
2014-01-21 Tim Shen <timshen91@gmail.com>
* include/bits/regex.tcc: Remove incorrect `nosubs` handling.

View File

@ -781,12 +781,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
public:
// [23.2.1.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
* @brief Creates a %deque with no elements.
*/
deque() : _Base() { }
/**
* @brief Creates a %deque with no elements.
* @param __a An allocator object.
*/
explicit
deque(const allocator_type& __a = allocator_type())
deque(const allocator_type& __a)
: _Base(__a) { }
#if __cplusplus >= 201103L

View File

@ -526,12 +526,19 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
public:
// [23.2.2.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
* @brief Creates a %list with no elements.
*/
list() _GLIBCXX_NOEXCEPT
: _Base() { }
/**
* @brief Creates a %list with no elements.
* @param __a An allocator object.
*/
explicit
list(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
list(const allocator_type& __a) _GLIBCXX_NOEXCEPT
: _Base(_Node_alloc_type(__a)) { }
#if __cplusplus >= 201103L

View File

@ -242,12 +242,18 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
public:
// [23.2.4.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
* @brief Creates a %vector with no elements.
*/
vector() _GLIBCXX_NOEXCEPT : _Base() { }
/**
* @brief Creates a %vector with no elements.
* @param __a An allocator object.
*/
explicit
vector(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L

View File

@ -68,8 +68,11 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.1.1 construct/copy/destroy:
deque() : _Base() { }
explicit
deque(const _Allocator& __a = _Allocator())
deque(const _Allocator& __a)
: _Base(__a) { }
#if __cplusplus >= 201103L

View File

@ -69,8 +69,12 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.2.1 construct/copy/destroy:
list() _GLIBCXX_NOEXCEPT
: _Base() { }
explicit
list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
list(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L

View File

@ -77,7 +77,10 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.1.1 construct/copy/destroy:
explicit map(const _Compare& __comp = _Compare(),
map() : _Base() { }
explicit map(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -78,7 +78,10 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.1.1 construct/copy/destroy:
explicit multimap(const _Compare& __comp = _Compare(),
multimap() : _Base() { }
explicit multimap(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -77,7 +77,10 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.3.1 construct/copy/destroy:
explicit multiset(const _Compare& __comp = _Compare(),
multiset() : _Base() { }
explicit multiset(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -76,7 +76,10 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.3.1 construct/copy/destroy:
explicit set(const _Compare& __comp = _Compare(),
set() : _Base() { }
explicit set(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -76,8 +76,12 @@ namespace __debug
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.4.1 construct/copy/destroy:
vector() _GLIBCXX_NOEXCEPT
: _Base(), _M_guaranteed_capacity(0) { }
explicit
vector(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a), _M_guaranteed_capacity(0) { }
#if __cplusplus >= 201103L

View File

@ -60,8 +60,12 @@ namespace __profile
typedef typename _Base::const_pointer const_pointer;
// 23.2.1.1 construct/copy/destroy:
deque()
: _Base() { }
explicit
deque(const _Allocator& __a = _Allocator())
deque(const _Allocator& __a)
: _Base(__a) { }
#if __cplusplus >= 201103L

View File

@ -64,8 +64,16 @@ template<typename _Tp, typename _Allocator = std::allocator<_Tp> >
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.2.2.1 construct/copy/destroy:
list() _GLIBCXX_NOEXCEPT
: _Base()
{
__profcxx_list_construct(this); // list2slist
__profcxx_list_construct2(this); // list2vector
}
explicit
list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
list(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a)
{
__profcxx_list_construct(this); // list2slist

View File

@ -67,8 +67,13 @@ namespace __profile
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// 23.3.1.1 construct/copy/destroy:
map()
: _Base()
{ __profcxx_map_to_unordered_map_construct(this); }
explicit
map(const _Compare& __comp = _Compare(),
map(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a)
{ __profcxx_map_to_unordered_map_construct(this); }

View File

@ -68,7 +68,11 @@ namespace __profile
typedef typename _Base::const_pointer const_pointer;
// 23.3.1.1 construct/copy/destroy:
explicit multimap(const _Compare& __comp = _Compare(),
multimap()
: _Base() { }
explicit multimap(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -68,7 +68,11 @@ namespace __profile
typedef typename _Base::const_pointer const_pointer;
// 23.3.3.1 construct/copy/destroy:
explicit multiset(const _Compare& __comp = _Compare(),
multiset()
: _Base() { }
explicit multiset(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -68,7 +68,11 @@ namespace __profile
typedef typename _Base::const_pointer const_pointer;
// 23.3.3.1 construct/copy/destroy:
explicit set(const _Compare& __comp = _Compare(),
set()
: _Base() { }
explicit set(const _Compare& __comp,
const _Allocator& __a = _Allocator())
: _Base(__comp, __a) { }

View File

@ -77,8 +77,16 @@ namespace __profile
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
// 23.2.4.1 construct/copy/destroy:
vector() _GLIBCXX_NOEXCEPT
: _Base()
{
__profcxx_vector_construct(this, this->capacity());
__profcxx_vector_construct2(this);
}
explicit
vector(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a)
{
__profcxx_vector_construct(this, this->capacity());

View File

@ -0,0 +1,28 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <deque>
void test01()
{
std::deque<int> a = {};
}

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1758 }
// { dg-error "no matching" "" { target *-*-* } 1764 }
#include <deque>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1691 }
// { dg-error "no matching" "" { target *-*-* } 1697 }
#include <deque>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1691 }
// { dg-error "no matching" "" { target *-*-* } 1697 }
#include <deque>
#include <utility>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1842 }
// { dg-error "no matching" "" { target *-*-* } 1848 }
#include <deque>

View File

@ -0,0 +1,28 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <list>
void test01()
{
std::list<int> a = {};
}

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1646 }
// { dg-error "no matching" "" { target *-*-* } 1653 }
#include <list>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1598 }
// { dg-error "no matching" "" { target *-*-* } 1605 }
#include <list>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1598 }
// { dg-error "no matching" "" { target *-*-* } 1605 }
#include <list>
#include <utility>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1598 }
// { dg-error "no matching" "" { target *-*-* } 1605 }
#include <list>

View File

@ -0,0 +1,28 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <map>
void test01()
{
std::map<int, int> a = {};
}

View File

@ -0,0 +1,28 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <map>
void test01()
{
std::multimap<int, int> a = {};
}

View File

@ -0,0 +1,28 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <set>
void test01()
{
std::multiset<int> a = {};
}

View File

@ -0,0 +1,28 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <set>
void test01()
{
std::set<int> a = {};
}

View File

@ -0,0 +1,29 @@
// Copyright (C) 2014 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/>.
// { dg-do compile }
// { dg-options "-std=gnu++11" }
// libstdc++/58764
#include <vector>
void test01()
{
std::vector<int> a = {};
std::vector<bool> b = {};
}

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1306 }
// { dg-error "no matching" "" { target *-*-* } 1312 }
#include <vector>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1232 }
// { dg-error "no matching" "" { target *-*-* } 1238 }
#include <vector>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1232 }
// { dg-error "no matching" "" { target *-*-* } 1238 }
#include <vector>
#include <utility>

View File

@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1347 }
// { dg-error "no matching" "" { target *-*-* } 1353 }
#include <vector>