From 89f06948596bcd48096396316c4a8108e2934820 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Thu, 20 Aug 2015 21:19:58 +0100 Subject: [PATCH] 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 --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/experimental/any | 19 +++++++++++-------- .../experimental/any/misc/any_cast_neg.cc | 2 +- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0c278c86657..ef0367b88b5 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,9 @@ 2015-08-20 Jonathan Wakely + * 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. diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index dae82b56e2f..4cdc1dc12c2 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -296,14 +296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Storage _M_storage; template - friend void* __any_caster(const any* __any) - { - if (__any->_M_manager != &_Manager>::_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 @@ -396,6 +389,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // @} + template + void* __any_caster(const any* __any) + { + if (__any->_M_manager != &any::_Manager>::_S_manage) + return nullptr; + any::_Arg __arg; + __any->_M_manager(any::_Op_access, __any, &__arg); + return __arg._M_obj; + } + /** * @brief Access the contained object. * diff --git a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc index 1d1180c36db..5c7595d79ef 100644 --- a/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc +++ b/libstdc++-v3/testsuite/experimental/any/misc/any_cast_neg.cc @@ -26,5 +26,5 @@ void test01() using std::experimental::any_cast; const any y(1); - any_cast(y); // { dg-error "qualifiers" "" { target { *-*-* } } 360 } + any_cast(y); // { dg-error "qualifiers" "" { target { *-*-* } } 353 } } -- 2.30.2