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&lt;boost::log::v2_mt_posix::attribute_value_set&gt;&amp;, const boost::log::v2_mt_posix::attribute_set&amp;, const boost::log::v2_mt_posix::attribute_set&amp;, 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&amp; thread_attrs, attribute_set consyt&amp; global_attrs, size_type reserve_count) { -&gt; implementation* p = source_attrs.m_pImpl; -&gt; source_attrs.m_pImpl = NULL; p-&gt;m_pThreadAttributes = thread_attrs.m_pImpl; p-&gt;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&lt;attribute_value_set&gt;&amp;, /* ... */ )</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 &lt;class T&gt; class A : public T { }; // represents 'class attribute_value_set' class B { // represents 'struct implementation' struct BS { static void blah( A&lt;B&gt;&amp;b, int y ) { b.x = y; } }; int x; public: B() : x(0) {} void stuff( int y ) { BS::blah( *this, y ); } operator A&lt;B&gt;&amp; () { return *static_cast&lt; A&lt;B&gt;* &gt;( this ); } }; int main( int argc, char *argv[] ) { B b; b.stuff( 3 ); return 0; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9139 Trac 1.4.3 Brian Vandenberg <phantall+boost@…> Tue, 24 Sep 2013 16:06:00 GMT cc 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> Ticket Andrey Semashev Tue, 24 Sep 2013 18:28:00 GMT status 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