Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions test/sstream_workaround.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,22 @@
// defining private as public makes it fail to compile sstream with gcc5.x like this:
// "error: ‘struct std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::
// __xfer_bufptrs’ redeclared with different access"
//
// Similarly, std::any in C++17 uses private access specifiers internally that
// would break with -Dprivate=public. Include it here before the macro takes effect.

#ifdef private
# undef private
# include <sstream>
# if __cplusplus >= 201703L
# include <any>
# endif
# define private public

@chenBright chenBright Jun 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using -fno-access-control instead of # define private public?

#else
# include <sstream>
# if __cplusplus >= 201703L
# include <any>
# endif
#endif

#endif // BUTIL_TEST_SSTREAM_WORKAROUND
Loading