Subject: [Boost-bugs] [Boost C++ Libraries] #9139: attribute_value_set.cpp fails to build correctly in Sun Studio 12.3
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-20 22:54:49
#9139: attribute_value_set.cpp fails to build correctly in Sun Studio 12.3
-------------------------------------------------+---------------------
Reporter: Brian Vandenberg <phantall+boost@â¦> | Owner: andysem
Type: Bugs | Status: new
Milestone: To Be Determined | Component: log
Version: Boost 1.54.0 | Severity: Problem
Keywords: |
-------------------------------------------------+---------------------
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;
}
}}}
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/9139> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:14 UTC