Boost C++ Libraries: Ticket #11664: BOOST_STATIC_ASSERT raises unused typedef error with new Apple Xcode 7 https://svn.boost.org/trac10/ticket/11664 <p> I've just updated by Apple Xcode (OS X compiler suite) to version 7. g++ version returns: </p> <pre class="wiki">Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 7.0.0 (clang-700.0.72) Target: x86_64-apple-darwin14.5.0 Thread model: posix </pre><p> Boost version is 1.58.0 and is installed by brew. The last stable version 1.59.0 has exactly the same code so should share the issue. </p> <p> Code using BOOST_STATIC_ASSERT raises this kind of errors: </p> <pre class="wiki">In file included from encode/base_n.cc:16: ../../../src/lib/util/encode/binary_from_base32hex.h:46:9: error: unused typedef 'boost_static_assert_typedef_46' [-Werror,-Wunused-local-typedef] BOOST_STATIC_ASSERT(0x80 == sizeof(lookup_table)); ^ /usr/local/include/boost/static_assert.hpp:170:16: note: expanded from macro 'BOOST_STATIC_ASSERT' BOOST_JOIN(boost_static_assert_typedef_, __LINE__) BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE ^ /usr/local/include/boost/config/suffix.hpp:544:28: note: expanded from macro 'BOOST_JOIN' #define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) ^ /usr/local/include/boost/config/suffix.hpp:545:31: note: expanded from macro 'BOOST_DO_JOIN' #define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) ^ /usr/local/include/boost/config/suffix.hpp:546:32: note: expanded from macro 'BOOST_DO_JOIN2' #define BOOST_DO_JOIN2( X, Y ) X##Y ^ &lt;scratch space&gt;:77:1: note: expanded from here boost_static_assert_typedef_46 ^ </pre><p> Note it is not a new issue, cf <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/7242" title="#7242: Bugs: GCC 4.8 warns unused local typedef (closed: fixed)">#7242</a>. But the fix in static_assert.hpp: </p> <pre class="wiki">// // If the compiler warns about unused typedefs then enable this: // #if defined(__GNUC__) &amp;&amp; ((__GNUC__ &gt; 4) || ((__GNUC__ == 4) &amp;&amp; (__GNUC_MINOR__ &gt;= 7))) # define BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE __attribute__((unused)) #else # define BOOST_STATIC_ASSERT_UNUSED_ATTRIBUTE #endif </pre><p> requires to handle the new Apple Clang. I tried with success: </p> <pre class="wiki">#if defined(__GNUC__) &amp;&amp; ((__GNUC__ &gt; 4) || ((__GNUC__ == 4) &amp;&amp; (__GNUC_MINOR__ &gt;= 7))) || (defined(__apple_build_version__) &amp;&amp; (__apple_build_version__ &gt;= 7000000)) </pre><p> I am attaching the diff. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11664 Trac 1.4.3 Francis Dupont <fdupont@…> Thu, 17 Sep 2015 10:42:03 GMT attachment set https://svn.boost.org/trac10/ticket/11664 https://svn.boost.org/trac10/ticket/11664 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">static_assert.hpp-diff</span> </li> </ul> <p> static_assert.hpp diff </p> Ticket Michel Morin Thu, 17 Sep 2015 13:56:52 GMT component, severity changed; owner set https://svn.boost.org/trac10/ticket/11664#comment:1 https://svn.boost.org/trac10/ticket/11664#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">John Maddock</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">static_assert</span> </li> <li><strong>severity</strong> <span class="trac-field-old">Showstopper</span> → <span class="trac-field-new">Problem</span> </li> </ul> Ticket Michel Morin Thu, 17 Sep 2015 13:58:27 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/11664#comment:2 https://svn.boost.org/trac10/ticket/11664#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> This is already fixed in 'develop' branch: <a class="ext-link" href="https://github.com/boostorg/static_assert/tree/develop"><span class="icon">​</span>https://github.com/boostorg/static_assert/tree/develop</a> </p> Ticket