Boost C++ Libraries: Ticket #10694: Apple Clang + NVCC - identifier "__is_abstract" is undefined https://svn.boost.org/trac10/ticket/10694 <p> While building with nvcc (NVIDIA CUDA compiler) and Clang on Mac OS X I get errors like these: </p> <p> /usr/local/include/boost/type_traits/is_abstract.hpp(72): error: identifier "<span class="underline">is_abstract" is undefined </span></p> <p> /usr/local/include/boost/type_traits/is_abstract.hpp(72): error: function call is not allowed in a constant expression </p> <p> /usr/local/include/boost/type_traits/is_abstract.hpp(72): error: type name is not allowed </p> <p> /usr/local/include/boost/type_traits/is_enum.hpp(180): error: identifier "<span class="underline">is_enum" is undefined </span></p> <p> /usr/local/include/boost/type_traits/is_enum.hpp(180): error: function call is not allowed in a constant expression </p> <p> /usr/local/include/boost/type_traits/is_enum.hpp(180): error: type name is not allowed </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/10694 Trac 1.4.3 John Maddock Fri, 24 Oct 2014 16:33:02 GMT <link>https://svn.boost.org/trac10/ticket/10694#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10694#comment:1</guid> <description> <p> This looks a lot like a clang bug to me, the code in type_traits/intrinsics.hpp sets the use of <span class="underline">is_abstract via: </span></p> <pre class="wiki"># if __has_feature(is_abstract) # define BOOST_IS_ABSTRACT(T) __is_abstract(T) # endif </pre><p> So... if clang <code>__has_feature</code> is indicating that <code>__is_abstract</code> is available what are we supposed to do? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 24 Oct 2014 16:34:46 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10694#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10694#comment:2</guid> <description> <p> BTW, forgot to ask, does: </p> <p> #include &lt;type_traits&gt; </p> <p> compile? What about if you try to use std::is_abstract? </p> </description> <category>Ticket</category> </item> <item> <author>nilsgladitz@…</author> <pubDate>Fri, 24 Oct 2014 17:42:18 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10694#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10694#comment:3</guid> <description> <p> Thank you for looking into this. </p> <p> #include &lt;type_traits&gt; and use of std::is_abstract seems to work with clang++ when directly invoked. </p> <p> When I try to run nvcc on it instead I get: </p> <blockquote> <p> fatal error: 'type_traits' file not found. </p> </blockquote> <p> Looking at the clang command line that nvcc runs it seems to be due to it adding -stdlib=libstdc++. Forcing -stdlib=libc++ seems to break the subsequent cudafe (CUDA front end) invocation: </p> <blockquote> <p> <a class="missing wiki">/Applications/Xcode</a>.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/<span class="underline">config(226): error: identifier "</span>char16_t" is undefined </p> </blockquote> <p> It looks like </p> <blockquote> <p> /usr/local/include/boost/type_traits/is_abstract.hpp(72): error: identifier "is_abstract" is undefined </p> </blockquote> <p> is also issued by cudafe while compiling the code that clang preprocessed rather than clang itself. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Fri, 24 Oct 2014 18:06:16 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10694#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10694#comment:4</guid> <description> <p> There should still be &lt;type_traits&gt; available even when -stdlib=libstdc++ is used, unless it's a really old libstdc++ version? </p> <p> Obviously I could disable the use of clang intrinsics when the compiler is cuda, but then the type traits wouldn't actually work :-( Plus these are also GCC intrinsics, so I'm rather surprised that it's not supported. </p> </description> <category>Ticket</category> </item> <item> <author>nilsgladitz@…</author> <pubDate>Fri, 24 Oct 2014 18:18:02 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10694#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10694#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/10694#comment:4" title="Comment 4">johnmaddock</a>: </p> <blockquote class="citation"> <p> There should still be &lt;type_traits&gt; available even when -stdlib=libstdc++ is used, unless it's a really old libstdc++ version? </p> </blockquote> <p> Development on OS X is still very new to me so I am not entirely sure if I am looking in all the right places but it seems the libstdc++ version being used is "20070719". The directory it is in seems to suggest this corresponds to gcc 4.2.1. </p> <p> As far as I understand Apple no longer distributes gcc so they might not be interested in maintaining or upgrading libstdc++. </p> </description> <category>Ticket</category> </item> <item> <author>nilsgladitz@…</author> <pubDate>Sat, 25 Oct 2014 13:04:58 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/10694#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/10694#comment:6</guid> <description> <p> Locally replacing </p> <pre class="wiki">#if defined(BOOST_CLANG) &amp;&amp; defined(__has_feature) </pre><p> with </p> <pre class="wiki">#if defined(BOOST_CLANG) &amp;&amp; defined(__has_feature) &amp;&amp; !defined(__CUDACC__) </pre><p> in type_traits/intrinsics.hpp does seem to work around this particular issue for me for now. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 10 Nov 2014 18:02:04 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/10694#comment:7 https://svn.boost.org/trac10/ticket/10694#comment:7 <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> Fixed in <a class="ext-link" href="https://github.com/boostorg/type_traits/commit/9b12c8ad6a0e9947c5bf930e782dd3f4d0fc6dba"><span class="icon">​</span>https://github.com/boostorg/type_traits/commit/9b12c8ad6a0e9947c5bf930e782dd3f4d0fc6dba</a> </p> Ticket