Commit 89f06948 by Jonathan Wakely Committed by Jonathan Wakely

any (__any_caster): Define at namespace scope so the name is visible to name lookup.

	* include/experimental/any (__any_caster): Define at namespace scope
	so the name is visible to name lookup.
	* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.

From-SVN: r227042
parent 92695fbb
2015-08-20 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/any (__any_caster): Define at namespace scope
so the name is visible to name lookup.
* testsuite/experimental/any/misc/any_cast_neg.cc: Adjust dg-error.
* python/Makefile.am: Ensure gdb.py is installed for libstdc++ not
libstdc++fs.
* python/Makefile.in: Regenerate.
......
......@@ -296,14 +296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_Storage _M_storage;
template<typename _Tp>
friend void* __any_caster(const any* __any)
{
if (__any->_M_manager != &_Manager<decay_t<_Tp>>::_S_manage)
return nullptr;
_Arg __arg;
__any->_M_manager(_Op_access, __any, &__arg);
return __arg._M_obj;
}
friend void* __any_caster(const any* __any);
// Manage in-place contained object.
template<typename _Tp>
......@@ -396,6 +389,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
// @}
template<typename _Tp>
void* __any_caster(const any* __any)
{
if (__any->_M_manager != &any::_Manager<decay_t<_Tp>>::_S_manage)
return nullptr;
any::_Arg __arg;
__any->_M_manager(any::_Op_access, __any, &__arg);
return __arg._M_obj;
}
/**
* @brief Access the contained object.
*
......
......@@ -26,5 +26,5 @@ void test01()
using std::experimental::any_cast;
const any y(1);
any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 360 }
any_cast<int&>(y); // { dg-error "qualifiers" "" { target { *-*-* } } 353 }
}
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