From b497fbc10a588b5b02c7f91246570b55795a2c5c Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Mon, 16 Jan 2017 11:41:41 +0000 Subject: [PATCH] PR78702 fix accessibility of locale::facet::__shim PR libstdc++/78702 * include/bits/locale_classes.h (locale::facet::__shim): Change from private to protected. * src/c++11/cxx11-shim_facets.cc (__shim_accessor): Define helper to make locale::facet::__shim accessible. From-SVN: r244491 --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/include/bits/locale_classes.h | 5 +++-- libstdc++-v3/src/c++11/cxx11-shim_facets.cc | 20 +++++++++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 998662a6457..7df1748053e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,11 @@ +2017-01-16 Jonathan Wakely + + PR libstdc++/78702 + * include/bits/locale_classes.h (locale::facet::__shim): Change from + private to protected. + * src/c++11/cxx11-shim_facets.cc (__shim_accessor): Define helper to + make locale::facet::__shim accessible. + 2017-01-16 Ville Voutilainen PR libstdc++/78389 diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h index 41adac6f77d..b63e9c8a3e2 100644 --- a/libstdc++-v3/include/bits/locale_classes.h +++ b/libstdc++-v3/include/bits/locale_classes.h @@ -461,10 +461,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } - class __shim; - const facet* _M_sso_shim(const id*) const; const facet* _M_cow_shim(const id*) const; + + protected: + class __shim; // For internal use only. }; diff --git a/libstdc++-v3/src/c++11/cxx11-shim_facets.cc b/libstdc++-v3/src/c++11/cxx11-shim_facets.cc index 9ad7300b0ee..b69959f4f13 100644 --- a/libstdc++-v3/src/c++11/cxx11-shim_facets.cc +++ b/libstdc++-v3/src/c++11/cxx11-shim_facets.cc @@ -226,8 +226,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION namespace // unnamed { + struct __shim_accessor : facet + { + using facet::__shim; // Redeclare protected member as public. + }; + using __shim = __shim_accessor::__shim; + template - struct numpunct_shim : std::numpunct<_CharT>, facet::__shim + struct numpunct_shim : std::numpunct<_CharT>, __shim { typedef typename numpunct<_CharT>::__cache_type __cache_type; @@ -251,7 +257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct collate_shim : std::collate<_CharT>, facet::__shim + struct collate_shim : std::collate<_CharT>, __shim { typedef basic_string<_CharT> string_type; @@ -276,7 +282,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct time_get_shim : std::time_get<_CharT>, facet::__shim + struct time_get_shim : std::time_get<_CharT>, __shim { typedef typename std::time_get<_CharT>::iter_type iter_type; typedef typename std::time_get<_CharT>::char_type char_type; @@ -330,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct moneypunct_shim : std::moneypunct<_CharT, _Intl>, facet::__shim + struct moneypunct_shim : std::moneypunct<_CharT, _Intl>, __shim { typedef typename moneypunct<_CharT, _Intl>::__cache_type __cache_type; @@ -357,7 +363,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct money_get_shim : std::money_get<_CharT>, facet::__shim + struct money_get_shim : std::money_get<_CharT>, __shim { typedef typename std::money_get<_CharT>::iter_type iter_type; typedef typename std::money_get<_CharT>::char_type char_type; @@ -398,7 +404,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct money_put_shim : std::money_put<_CharT>, facet::__shim + struct money_put_shim : std::money_put<_CharT>, __shim { typedef typename std::money_put<_CharT>::iter_type iter_type; typedef typename std::money_put<_CharT>::char_type char_type; @@ -427,7 +433,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; template - struct messages_shim : std::messages<_CharT>, facet::__shim + struct messages_shim : std::messages<_CharT>, __shim { typedef messages_base::catalog catalog; typedef basic_string<_CharT> string_type; -- 2.30.2