Commit 6e2e575a by Jonathan Wakely Committed by Jonathan Wakely

PR libstdc++/80504 qualify calls to avoid ADL

	PR libstdc++/80504
	* include/bits/refwrap.h (ref, cref): Qualify calls.
	* testsuite/20_util/reference_wrapper/80504.cc: New test.

From-SVN: r247094
parent 71f257f7
2017-04-24 Jonathan Wakely <jwakely@redhat.com> 2017-04-24 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/80504
* include/bits/refwrap.h (ref, cref): Qualify calls.
* testsuite/20_util/reference_wrapper/80504.cc: New test.
PR libstdc++/80493 PR libstdc++/80493
* include/experimental/optional (optional::swap): Fix exception * include/experimental/optional (optional::swap): Fix exception
specification. specification.
......
...@@ -361,17 +361,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION ...@@ -361,17 +361,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Tp> template<typename _Tp>
void cref(const _Tp&&) = delete; void cref(const _Tp&&) = delete;
/// Partial specialization. /// std::ref overload to prevent wrapping a reference_wrapper
template<typename _Tp> template<typename _Tp>
inline reference_wrapper<_Tp> inline reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t) noexcept ref(reference_wrapper<_Tp> __t) noexcept
{ return ref(__t.get()); } { return __t; }
/// Partial specialization. /// std::cref overload to prevent wrapping a reference_wrapper
template<typename _Tp> template<typename _Tp>
inline reference_wrapper<const _Tp> inline reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t) noexcept cref(reference_wrapper<_Tp> __t) noexcept
{ return cref(__t.get()); } { return { __t.get() }; }
// @} group functors // @} group functors
......
// 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
// <http://www.gnu.org/licenses/>.
// { dg-do compile { target c++11 } }
#include <functional>
namespace X {
struct Y { };
template<typename T> void ref(T) { }
template<typename T> void cref(T) { }
}
int main()
{
X::Y i;
std::reference_wrapper<X::Y> r(i);
ref(r);
cref(r);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment