Boost C++ Libraries: Ticket #9139: attribute_value_set.cpp fails to build correctly in Sun Studio 12.3
https://svn.boost.org/trac10/ticket/9139
<p>
When building <strong>boost::log</strong>, I'm getting the following error:
</p>
<pre class="wiki">"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 ).
</pre><p>
The same error happens on line 214 as well.
</p>
<p>
Here's the code in question:
</p>
<pre class="wiki">/* ... */
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;
}
</pre><p>
In <strong>boost/log/attributes/attribute_value_set.hpp</strong>, on or about line 97, the private struct <strong>implementation</strong> is pre-declared but is not marked as a friend. In the body for <strong>attribute_value_set::implementation::create( ::boost::rv<attribute_value_set>&, /* ... */ )</strong> (on or about line 208 in <strong>attribute_value_set.cpp</strong>), the compiler complains that <strong>m_pImpl</strong> is not accessible.
</p>
<p>
This is not reproducible on gcc (3.4.6 and 4.4.6) or clang. If the header for <strong>attribute_value_set</strong> is modified to make <strong>implementation</strong> a friend class, the problem goes away.
</p>
<p>
The following is a piece of example code that exemplifies the problematic idiom; again, this [so far] is only reproducible in Sun Studio:
</p>
<pre class="wiki">// 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;
}
</pre>en-usBoost C++ Libraries/htdocs/site/boost.png
https://svn.boost.org/trac10/ticket/9139
Trac 1.4.3Brian Vandenberg <phantall+boost@…>Tue, 24 Sep 2013 16:06:00 GMTcc set
https://svn.boost.org/trac10/ticket/9139#comment:1
https://svn.boost.org/trac10/ticket/9139#comment:1
<ul>
<li><strong>cc</strong>
<span class="trac-author">phantall+boost@…</span> added
</li>
</ul>
TicketAndrey SemashevTue, 24 Sep 2013 18:28:00 GMTstatus changed; resolution set
https://svn.boost.org/trac10/ticket/9139#comment:2
https://svn.boost.org/trac10/ticket/9139#comment:2
<ul>
<li><strong>status</strong>
<span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span>
</li>
<li><strong>resolution</strong>
→ <span class="trac-field-new">fixed</span>
</li>
</ul>
<p>
(In <a class="changeset" href="https://svn.boost.org/trac10/changeset/85871" title="Fixed #9139.">[85871]</a>) Fixed <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9139" title="#9139: Bugs: attribute_value_set.cpp fails to build correctly in Sun Studio 12.3 (closed: fixed)">#9139</a>.
</p>
Ticket