Boost C++ Libraries: Ticket #9153: Building boost::log in Sun Studio 12.3: boost::log::aux::light_function fails to build https://svn.boost.org/trac10/ticket/9153 <p> I get an error building boost::log in Sun Studio 12.3, while building anything that uses <strong>light_function_pp.hpp</strong>: </p> <pre class="wiki">"./boost/log/detail/light_function_pp.hpp", line 44: Error: Multiple declaration for impl. "./boost/log/expressions/filter.hpp", line 58: Where: While specializing "boost::log::v2_mt_posix::aux::light_function&lt;bool(const boost::log::v2_mt_posix::attribute_value_set&amp;)&gt;". "./boost/log/expressions/filter.hpp", line 58: Where: Specialized in non-template code. </pre><p> I can reproduce this problem on a much smaller scale: </p> <pre class="wiki">template &lt; typename SignatureT &gt; class light_function ; template &lt; typename ResultT, typename ArgT0 &gt; class light_function &lt; ResultT ( ArgT0 ) &gt; { private: struct impl_base {}; impl_base *m_pImpl; #if defined( BREAK_IT ) template &lt; typename FunT &gt; class impl; template &lt; typename FunT &gt; friend class impl; #endif template &lt; typename FunT &gt; class impl : public impl_base {}; #if !defined( BREAK_IT ) template &lt; typename FunT &gt; friend class impl; #endif public: template &lt;typename T&gt; light_function( T const &amp;t ) : m_pImpl( static_cast&lt;impl_base*)new impl&lt;T&gt;() ) {} }; int main( int argc, char *argv[] ) { light_function&lt;bool(int&amp;)&gt; lf(3); return 0; } </pre><p> When compiled in Linux or Solaris with SS12.3, I get the exact same error. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9153 Trac 1.4.3 Brian Vandenberg <phantall+boost@…> Mon, 23 Sep 2013 21:22:38 GMT <link>https://svn.boost.org/trac10/ticket/9153#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:1</guid> <description> <p> I forgot to mention, though I hope it's obvious: compile with <code></code><code>-DBREAK_IT</code><code></code> to see the problem. </p> </description> <category>Ticket</category> </item> <item> <author>Brian Vandenberg <phantall+boost@…></author> <pubDate>Mon, 23 Sep 2013 21:25:10 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9153#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:2</guid> <description> <p> As for the 'why' of this, I'm not really sure. The <code></code><code>attribute_set</code><code></code> and <code></code><code>attribute_value_set</code><code></code> classes (among others) use this idiom of forward declaring a class before marking it as a friend class. </p> <p> I tried using some compiler options to force it to only use explicitly specialized versions of the class and the error wouldn't go away. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Mon, 23 Sep 2013 21:33:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9153#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:3</guid> <description> <p> Unfortunately, I don't have access to this compiler, neither there are testers using it in the test farm. So the only way I can fix this is if you provide a patch or through some experiments to figure out the source of the problem. </p> <p> Could you try to move impl definition out of light_function body? </p> </description> <category>Ticket</category> </item> <item> <author>Brian Vandenberg <phantall+boost@…></author> <pubDate>Tue, 24 Sep 2013 16:03:44 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9153#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:4</guid> <description> <p> Andy, </p> <blockquote> <p> If you remove the forward declaration for impl and move the friend statement to after the impl body, the error goes away. </p> </blockquote> </description> <category>Ticket</category> </item> <item> <author>Brian Vandenberg <phantall+boost@…></author> <pubDate>Tue, 24 Sep 2013 16:03:53 GMT</pubDate> <title>cc set https://svn.boost.org/trac10/ticket/9153#comment:5 https://svn.boost.org/trac10/ticket/9153#comment:5 <ul> <li><strong>cc</strong> <span class="trac-author">phantall+boost@…</span> added </li> </ul> Ticket Andrey Semashev Tue, 24 Sep 2013 18:18:01 GMT <link>https://svn.boost.org/trac10/ticket/9153#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:6</guid> <description> <p> Does it help if you just define BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS macro? </p> </description> <category>Ticket</category> </item> <item> <author>Brian Vandenberg <phantall+boost@…></author> <pubDate>Tue, 24 Sep 2013 19:48:06 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9153#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:7</guid> <description> <p> Yes. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Andrey Semashev</dc:creator> <pubDate>Tue, 24 Sep 2013 20:20:35 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9153#comment:8 https://svn.boost.org/trac10/ticket/9153#comment:8 <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/85873" title="Disabled friend declarations for nested class templates for SunPro ...">[85873]</a>) Disabled friend declarations for nested class templates for <a class="missing wiki">SunPro</a> compiler. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/9153" title="#9153: Bugs: Building boost::log in Sun Studio 12.3: ... (closed: fixed)">#9153</a>. </p> Ticket Brian Vandenberg <phantall+boost@…> Wed, 25 Sep 2013 15:30:51 GMT <link>https://svn.boost.org/trac10/ticket/9153#comment:9 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9153#comment:9</guid> <description> <p> Andy, </p> <blockquote> <p> I haven't found a download link for it, but back in 2008 they began releasing 'express' versions of the compiler suite. It may be possible to get an express version for the current sun studio compiler. </p> </blockquote> </description> <category>Ticket</category> </item> </channel> </rss>