Modify

Ticket #9139 (closed Bugs: fixed)

Opened 7 months ago

Last modified 7 months ago

attribute_value_set.cpp fails to build correctly in Sun Studio 12.3

Reported by: Brian Vandenberg <phantall+boost@…> Owned by: andysem
Milestone: To Be Determined Component: log
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc: phantall+boost@…

Description

When building boost::log, I'm getting the following error:

"libs/log/src/attribute_value_set.cpp", line 213: Error: m_pImpl is not accessible from static boost::log::v2_mt_posix::attribute_value_set::implementation::create( boost::rv<boost::log::v2_mt_posix::attribute_value_set>&, const boost::log::v2_mt_posix::attribute_set&, const boost::log::v2_mt_posix::attribute_set&, unsigned ).

The same error happens on line 214 as well.

Here's the code in question:

/* ... */
static implementation* create(
    BOOST_RV_REF(attribute_value_set) source_attrs,
    attribute_set const& thread_attrs,
    attribute_set consyt& global_attrs,
    size_type reserve_count)
{
->  implementation* p = source_attrs.m_pImpl;
->  source_attrs.m_pImpl = NULL;
    p->m_pThreadAttributes = thread_attrs.m_pImpl;
    p->m_pGlobalAttributes = global_attrs.m_pImpl;
    return p;
}

In boost/log/attributes/attribute_value_set.hpp, on or about line 97, the private struct implementation is pre-declared but is not marked as a friend. In the body for attribute_value_set::implementation::create( ::boost::rv<attribute_value_set>&, /* ... */ ) (on or about line 208 in attribute_value_set.cpp), the compiler complains that m_pImpl is not accessible.

This is not reproducible on gcc (3.4.6 and 4.4.6) or clang. If the header for attribute_value_set is modified to make implementation a friend class, the problem goes away.

The following is a piece of example code that exemplifies the problematic idiom; again, this [so far] is only reproducible in Sun Studio:

// represents 'boost::rv'
template <class T>
class A : public T {
};

// represents 'class attribute_value_set'
class B {
  // represents 'struct implementation'
  struct BS {
    static void blah( A<B>&b, int y ) {
      b.x = y;
    }
  };

  int x;

public:
  B() : x(0) {}
  void stuff( int y ) {
    BS::blah( *this, y );
  }

  operator A<B>& () {
    return *static_cast< A<B>* >( this );
  }
};

int main( int argc, char *argv[] ) {
  B b;

  b.stuff( 3 );

  return 0;
}

Attachments

Change History

comment:1 Changed 7 months ago by Brian Vandenberg <phantall+boost@…>

  • Cc phantall+boost@… added

comment:2 Changed 7 months ago by andysem

  • Status changed from new to closed
  • Resolution set to fixed

(In [85871]) Fixed #9139.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.