@@ -381,6 +381,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#endif
};
+#ifdef __cpp_variable_templates
+ template<typename _Tp>
+ constexpr bool __is_facet = __is_base_of(locale::facet, _Tp);
+ template<typename _Tp>
+ constexpr bool __is_facet<volatile _Tp> = false;
+#endif
// 22.1.1.1.2 Class locale::facet
/**
@@ -71,6 +71,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
locale::
combine(const locale& __other) const
{
+#ifdef __cpp_variable_templates
+ static_assert(__is_facet<_Facet>, "");
+#endif
+
_Impl* __tmp = new _Impl(*_M_impl, 1);
__try
{
@@ -110,7 +114,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// We know these standard facets are always installed in every locale
// so dynamic_cast always succeeds, just use static_cast instead.
#define _GLIBCXX_STD_FACET(...) \
- if _GLIBCXX_CONSTEXPR (__is_same(_Facet, __VA_ARGS__)) \
+ if _GLIBCXX_CONSTEXPR (__is_same(const _Facet, const __VA_ARGS__)) \
return static_cast<const _Facet*>(__facets[__i])
_GLIBCXX_STD_FACET(ctype<char>);