I'm trying to compile code with GCC 5.1.0 which makes use of the good ole: #define private public hack (for some reason). I know, I know, but it's not my code and I'd like it to compile out of the box... Now the issue is this: In GCC 5.1.0's version of the sstream header one finds the following: template<typename _CharT, typename _Traits, typename _Alloc> class basic_stringbuf : public basic_streambuf<_CharT, _Traits> { struct __xfer_bufptrs; public: // Types: typedef _CharT char_type; typedef _Traits traits_type; [...] private: [...] struct __xfer_bufptrs { [...] The problem is that the member __xfer_bufptrs is implicitly private when it's declared but then later it's expliclity marked private. Then, due to the #define private public, the second one turns public but the first one does not and there's a conflict leading to this error: /usr/include/c++/5.1.0/sstream:335:7: error: ‘struct std::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ redeclared with different access struct __xfer_bufptrs ^ Any chance to mark the first instance private explicitly?
No. Use -fno-access-control which does it properly.
Ugh, -fno-access-control doesn't prevent the error. Then I suggest using -include sstream, so that stringstream is included before some idiot comes along and redefines a keyword. But I'm not interested in supporting -Dprivate=public, it's just wrong.