[PATCH] PR78702 fix accessibility of locale::facet::__shim
Jonathan Wakely
jwakely@redhat.com
Mon Jan 16 11:41:00 GMT 2017
This fixes a bug that prevents building the library with Clang (though
I don't know why anybody's doing that). G++ doesn't notice it due to
one of our bugs with access checking in templates.
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.
Tested powercp64le-linux, committed to trunk.
-------------- next part --------------
commit 71f9cd2ee86aaea28cb293be20d01adaa1178f9c
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Jan 16 11:11:55 2017 +0000
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.
diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h
index 41adac6..b63e9c8 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 9ad7300..b69959f 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<typename _CharT>
- 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<typename _CharT>
- 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<typename _CharT>
- 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<typename _CharT, bool _Intl>
- 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<typename _CharT>
- 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<typename _CharT>
- 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<typename _CharT>
- 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;
More information about the Gcc-patches
mailing list