diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 61740dc7c8e..89026883cd1 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2017-12-01 Jonathan Wakely + Backport from mainline + 2017-11-30 Jonathan Wakely + + PR libstdc++/83226 + * include/bits/node_handle.h (_Node_handle::__pointer): Avoid forming + pointer-to-reference types. + * testsuite/23_containers/map/modifiers/insert/83226.cc: New test. + Backport from mainline 2017-11-14 Jonathan Wakely diff --git a/libstdc++-v3/include/bits/node_handle.h b/libstdc++-v3/include/bits/node_handle.h index 4a830630c89..f75f7425f47 100644 --- a/libstdc++-v3/include/bits/node_handle.h +++ b/libstdc++-v3/include/bits/node_handle.h @@ -199,7 +199,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } template - using __pointer = __ptr_rebind; + using __pointer + = __ptr_rebind>; __pointer<_Key> _M_pkey = nullptr; __pointer _M_pmapped = nullptr; diff --git a/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc new file mode 100644 index 00000000000..4a660dd7469 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/modifiers/insert/83226.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2017 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 +// . + +// { dg-options "-std=gnu++17" } +// { dg-do compile { target c++1z } } + +#include + +void +test01() +{ + int i = 0; + std::map m; + std::pair p{1, i}; + m.insert(p); // PR libstdc++/83226 +}