From 4bf6461ca1a5928f8f6c8f4551396bfe2a1e6002 Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Wed, 17 Dec 2025 12:21:18 +0100 Subject: [PATCH] Work around a bug in GCC 5-10 GCC 5-10 incorrectly complain about our nested classes being private. So, make them public. --- include/boost/static_string/config.hpp | 7 +++++++ include/boost/static_string/static_string.hpp | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/include/boost/static_string/config.hpp b/include/boost/static_string/config.hpp index 5af2b13..35dcdec 100644 --- a/include/boost/static_string/config.hpp +++ b/include/boost/static_string/config.hpp @@ -279,4 +279,11 @@ using basic_string_view = #define BOOST_STATIC_STRING_USE_STD_FORMAT #endif +#if defined(__GNUC__) && (__GNUC__ >= 5) && (__GNUC__ <= 10) && !defined(__clang__) +// Workaround for GCC complaining about nested classes being private. +#define BOOST_STATIC_STRING_GCC_NESTED_CLASS_WORKAROUND public: +#else +#define BOOST_STATIC_STRING_GCC_NESTED_CLASS_WORKAROUND +#endif + #endif diff --git a/include/boost/static_string/static_string.hpp b/include/boost/static_string/static_string.hpp index b350a98..75556d3 100644 --- a/include/boost/static_string/static_string.hpp +++ b/include/boost/static_string/static_string.hpp @@ -322,6 +322,8 @@ class static_string_base using pointer = value_type*; using const_pointer = const value_type*; +BOOST_STATIC_STRING_GCC_NESTED_CLASS_WORKAROUND + struct size { class basic_static_string @@ -388,6 +390,8 @@ class static_string_base<0, CharT, Traits> using value_type = typename Traits::char_type; using pointer = value_type*; +BOOST_STATIC_STRING_GCC_NESTED_CLASS_WORKAROUND + struct size { class basic_static_string