https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65899

            Bug ID: 65899
           Summary: std::basic_stringbuf member __xfer_bufptrs should be
                    explicitly declared private
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bastian.beisc...@rwth-aachen.de
  Target Milestone: ---

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?

Reply via email to