Boost C++ Libraries: Ticket #11897: Compile failure in type_traits_detail::mp_valid_impl with CUDA 7.0 https://svn.boost.org/trac10/ticket/11897 <p> Including boost/thread/pthread/timespec.hpp and compiling with nvcc 7.0 in C++11 mode throws several errors related to mp_valid_impl. This bug seems to be a compiler bug which is fixed in CUDA 7.5 but as many HPC system only have (and will have) 7.0 this is a real showstopper. Log output is: </p> <pre class="wiki">/opt/pkg/devel/cuda/7.0/bin/nvcc -std=c++11 BoostMpValid.cu /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/detail/mp_defer.hpp(33): error: no instance of overloaded function "boost::type_traits_detail::mp_valid_impl&lt;F, T...&gt;::check [with F=boost::type_traits_detail::common_type_fold, T=&lt;int_least64_t, int_least64_t, intmax_t&gt;]" matches the argument list argument types are: (int) detected during: instantiation of class "boost::type_traits_detail::mp_valid_impl&lt;F, T...&gt; [with F=boost::type_traits_detail::common_type_fold, T=&lt;int_least64_t, int_least64_t, intmax_t&gt;]" (37): here instantiation of type "boost::type_traits_detail::mp_valid&lt;boost::type_traits_detail::common_type_fold, int_least64_t, int_least64_t, intmax_t&gt;" (50): here instantiation of type "boost::type_traits_detail::mp_defer&lt;boost::type_traits_detail::common_type_fold, int_least64_t, int_least64_t, intmax_t&gt;" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(47): here instantiation of class "boost::common_type&lt;T1, T2, T...&gt; [with T1=int_least64_t, T2=int_least64_t, T=&lt;intmax_t&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(256): here instantiation of "ToDuration boost::chrono::detail::duration_cast_aux&lt;FromDuration, ToDuration, Period, true, false&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds, Period=boost::ratio&lt;1L, 1000000000L&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(315): here instantiation of "ToDuration boost::chrono::detail::duration_cast&lt;FromDuration, ToDuration&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(789): here instantiation of "boost::enable_if&lt;boost::chrono::detail::is_duration&lt;ToDuration&gt;, ToDuration&gt;::type boost::chrono::duration_cast&lt;ToDuration,Rep,Period&gt;(const boost::chrono::duration&lt;Rep, Period&gt; &amp;) [with ToDuration=boost::chrono::seconds, Rep=int_least64_t, Period=boost::nano]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/thread/pthread/timespec.hpp(51): here /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/detail/mp_defer.hpp(50): error: name followed by "::" must be a class or namespace name detected during: instantiation of type "boost::type_traits_detail::mp_defer&lt;boost::type_traits_detail::common_type_fold, int_least64_t, int_least64_t, intmax_t&gt;" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(47): here instantiation of class "boost::common_type&lt;T1, T2, T...&gt; [with T1=int_least64_t, T2=int_least64_t, T=&lt;intmax_t&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(256): here instantiation of "ToDuration boost::chrono::detail::duration_cast_aux&lt;FromDuration, ToDuration, Period, true, false&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds, Period=boost::ratio&lt;1L, 1000000000L&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(315): here instantiation of "ToDuration boost::chrono::detail::duration_cast&lt;FromDuration, ToDuration&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(789): here instantiation of "boost::enable_if&lt;boost::chrono::detail::is_duration&lt;ToDuration&gt;, ToDuration&gt;::type boost::chrono::duration_cast&lt;ToDuration,Rep,Period&gt;(const boost::chrono::duration&lt;Rep, Period&gt; &amp;) [with ToDuration=boost::chrono::seconds, Rep=int_least64_t, Period=boost::nano]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/thread/pthread/timespec.hpp(51): here /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/detail/mp_defer.hpp(33): error: no instance of overloaded function "boost::type_traits_detail::mp_valid_impl&lt;F, T...&gt;::check [with F=boost::type_traits_detail::builtin_common_type, T=&lt;int_least64_t, int_least64_t&gt;]" matches the argument list argument types are: (int) detected during: instantiation of class "boost::type_traits_detail::mp_valid_impl&lt;F, T...&gt; [with F=boost::type_traits_detail::builtin_common_type, T=&lt;int_least64_t, int_least64_t&gt;]" (37): here instantiation of type "boost::type_traits_detail::mp_valid&lt;boost::type_traits_detail::builtin_common_type, int_least64_t, int_least64_t&gt;" (50): here instantiation of type "boost::type_traits_detail::mp_defer&lt;boost::type_traits_detail::builtin_common_type, int_least64_t, int_least64_t&gt;" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(96): here instantiation of class "boost::type_traits_detail::common_type_impl&lt;T1, T2&gt; [with T1=int_least64_t, T2=int_least64_t]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(132): here instantiation of class "boost::type_traits_detail::common_type_decay_helper&lt;T1, T2, T1, T2&gt; [with T1=int_least64_t, T2=int_least64_t]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(138): here [ 3 instantiation contexts not shown ] instantiation of class "boost::type_traits_detail::mp_defer_impl&lt;F, T...&gt; [with F=boost::type_traits_detail::common_type_fold, T=&lt;int_least64_t, int_least64_t, intmax_t&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(47): here instantiation of class "boost::common_type&lt;T1, T2, T...&gt; [with T1=int_least64_t, T2=int_least64_t, T=&lt;intmax_t&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(256): here instantiation of "ToDuration boost::chrono::detail::duration_cast_aux&lt;FromDuration, ToDuration, Period, true, false&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds, Period=boost::ratio&lt;1L, 1000000000L&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(315): here instantiation of "ToDuration boost::chrono::detail::duration_cast&lt;FromDuration, ToDuration&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(789): here instantiation of "boost::enable_if&lt;boost::chrono::detail::is_duration&lt;ToDuration&gt;, ToDuration&gt;::type boost::chrono::duration_cast&lt;ToDuration,Rep,Period&gt;(const boost::chrono::duration&lt;Rep, Period&gt; &amp;) [with ToDuration=boost::chrono::seconds, Rep=int_least64_t, Period=boost::nano]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/thread/pthread/timespec.hpp(51): here /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/detail/mp_defer.hpp(50): error: name followed by "::" must be a class or namespace name detected during: instantiation of type "boost::type_traits_detail::mp_defer&lt;boost::type_traits_detail::builtin_common_type, int_least64_t, int_least64_t&gt;" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(96): here instantiation of class "boost::type_traits_detail::common_type_impl&lt;T1, T2&gt; [with T1=int_least64_t, T2=int_least64_t]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(132): here instantiation of class "boost::type_traits_detail::common_type_decay_helper&lt;T1, T2, T1, T2&gt; [with T1=int_least64_t, T2=int_least64_t]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(138): here instantiation of class "boost::common_type&lt;T1, T2&gt; [with T1=int_least64_t, T2=int_least64_t]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(37): here instantiation of type "boost::common_type_t&lt;int_least64_t, int_least64_t&gt;" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(42): here instantiation of type "boost::type_traits_detail::common_type_fold&lt;int_least64_t, int_least64_t, intmax_t&gt;" (47): here instantiation of class "boost::type_traits_detail::mp_defer_impl&lt;F, T...&gt; [with F=boost::type_traits_detail::common_type_fold, T=&lt;int_least64_t, int_least64_t, intmax_t&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/type_traits/common_type.hpp(47): here instantiation of class "boost::common_type&lt;T1, T2, T...&gt; [with T1=int_least64_t, T2=int_least64_t, T=&lt;intmax_t&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(256): here instantiation of "ToDuration boost::chrono::detail::duration_cast_aux&lt;FromDuration, ToDuration, Period, true, false&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds, Period=boost::ratio&lt;1L, 1000000000L&gt;]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(315): here instantiation of "ToDuration boost::chrono::detail::duration_cast&lt;FromDuration, ToDuration&gt;::operator()(const FromDuration &amp;) const [with FromDuration=boost::chrono::duration&lt;int_least64_t, boost::nano&gt;, ToDuration=boost::chrono::seconds]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/chrono/duration.hpp(789): here instantiation of "boost::enable_if&lt;boost::chrono::detail::is_duration&lt;ToDuration&gt;, ToDuration&gt;::type boost::chrono::duration_cast&lt;ToDuration,Rep,Period&gt;(const boost::chrono::duration&lt;Rep, Period&gt; &amp;) [with ToDuration=boost::chrono::seconds, Rep=int_least64_t, Period=boost::nano]" /opt/pkg/devel/boost/1.60.0/gnu/4.8.2/64/opt/include/boost/thread/pthread/timespec.hpp(51): here </pre><p> I have reduced it to the following MWE which gives the same error (CUDA 7.0, Boost 1.60): </p> <pre class="wiki">#include &lt;boost/type_traits/common_type.hpp&gt; #include &lt;cstdint&gt; int main(){ boost::common_type&lt;int_least64_t, int_least64_t, intmax_t&gt;::type i; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11897 Trac 1.4.3 Alex Grund <a.grund@…> Fri, 08 Jan 2016 14:50:20 GMT <link>https://svn.boost.org/trac10/ticket/11897#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:1</guid> <description> <p> This bug was introduced in 1.60. 1.59 is working fine. As the following code shows, the problem is related to variadic templates: </p> <pre class="wiki">#include &lt;type_traits&gt; template&lt;template&lt;class...&gt; class F, class... T&gt; struct mp_valid_impl { template&lt;template&lt;class...&gt; class G, class = G&lt;T...&gt;&gt; static int check(int); template&lt;template&lt;class...&gt; class&gt; static bool check(...); using type = decltype(check&lt;F&gt;(0)); }; template&lt;template&lt;class...&gt; class F, class T&gt; struct mp_valid_impl2 { template&lt;template&lt;class...&gt; class G, class = G&lt;T&gt;&gt; static int check(int); template&lt;template&lt;class...&gt; class&gt; static bool check(...); using type = decltype(check&lt;F&gt;(0)); }; template&lt;template&lt;class&gt; class F, class T&gt; struct mp_valid_impl3 { template&lt;template&lt;class&gt; class G, class = G&lt;T&gt;&gt; static int check(int); template&lt;template&lt;class&gt; class&gt; static bool check(...); using type = decltype(check&lt;F&gt;(0)); }; template&lt;typename T&gt; struct MetaFunc{}; int main(){ typename mp_valid_impl&lt;MetaFunc, int&gt;::type i; typename mp_valid_impl2&lt;MetaFunc, int&gt;::type i2; typename mp_valid_impl3&lt;MetaFunc, int&gt;::type i3; } </pre><p> Output: </p> <pre class="wiki">BoostMpValid.cu(12): error: no instance of overloaded function "mp_valid_impl&lt;F, T...&gt;::check [with F=MetaFunc, T=&lt;int&gt;]" matches the argument list argument types are: (int) detected during instantiation of class "mp_valid_impl&lt;F, T...&gt; [with F=MetaFunc, T=&lt;int&gt;]" (44): here BoostMpValid.cu(24): error: no instance of overloaded function "mp_valid_impl2&lt;F, T&gt;::check [with F=MetaFunc, T=int]" matches the argument list argument types are: (int) detected during instantiation of class "mp_valid_impl2&lt;F, T&gt; [with F=MetaFunc, T=int]" (45): here BoostMpValid.cu(46): warning: variable "i3" was declared but never referenced </pre><p> So only the non-variadic version works. A simple workaround is probably to deactivate variadic templates by defining BOOST_NO_CXX11_VARIADIC_TEMPLATES for nvcc &lt; 7.5. 7.5 is working so this can be used there. </p> </description> <category>Ticket</category> </item> <item> <author>Alex Grund <a.grund@…></author> <pubDate>Fri, 08 Jan 2016 15:05:34 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:2</guid> <description> <p> Possible workaround: Add the following to the end of config/compiler/nvcc.hpp; </p> <pre class="wiki">// A bug in version 7.0 of CUDA prevents use of variadic templates in some occasions // https://svn.boost.org/trac/boost/ticket/11897 // This is fixed in 7.5. As the following version macro was introduced in 7.5 an existance // check is enough to detect versions &lt; 7.5 #ifndef __CUDACC_VER__ # define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sun, 10 Jan 2016 12:14:50 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:3</guid> <description> <p> Many thanks for investigating this so thoroughly. My only worry about setting BOOST_NO_CXX11_VARIADIC_TEMPLATES as a workaround, is that it may disable otherwise working code in other library interfaces. Does the patch below fix things? </p> <pre class="wiki">index 5c4303b..4a26d92 100644 --- a/include/boost/type_traits/common_type.hpp +++ b/include/boost/type_traits/common_type.hpp @@ -12,12 +12,13 @@ #include &lt;boost/config.hpp&gt; #include &lt;boost/type_traits/decay.hpp&gt; #include &lt;boost/type_traits/declval.hpp&gt; +#include &lt;boost/detail/workaround.hpp&gt; #if defined(BOOST_NO_CXX11_DECLTYPE) #include &lt;boost/type_traits/detail/common_type_impl.hpp&gt; #endif -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &amp;&amp; !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &amp;&amp; !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !BOOST_WORKAROUND(__CUDACC_VER__, &lt; 70500) #include &lt;boost/type_traits/detail/mp_defer.hpp&gt; #endif @@ -26,7 +27,7 @@ namespace boost // variadic common_type -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !BOOST_WORKAROUND(__CUDACC_VER__, &lt; 70500) template&lt;class... T&gt; struct common_type { </pre> </description> <category>Ticket</category> </item> <item> <author>Alex Grund <a.grund@…></author> <pubDate>Mon, 11 Jan 2016 12:38:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:4</guid> <description> <p> I was proposing to disable this as this is 1 case where variadic templates fail in NVCC 7.0 so I would not rely on its correctness and avoid it. </p> <p> The proposed patch of yours does not work for 2 reasons: 1) You forgot one #if on line 89 2) The symbol is undefined in 7.0 and prior. Due to the check in BOOST_WORKAROUND for the existance and !=0 of the symbol it will always yield false. I don't see a good way to use that macro here. Using the plain defined(...) or ...&gt;=70500 works. </p> </description> <category>Ticket</category> </item> <item> <author>Alex Grund <a.grund@…></author> <pubDate>Mon, 11 Jan 2016 12:39:49 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:5</guid> <description> <table class="wiki"> <tr>Note that there is already a check in that form: #if !defined(BOOST_MSVC) <td> BOOST_MSVC &gt; 1800 </td></tr></table> <p> So using the &gt;= would probably be ok </p> </description> <category>Ticket</category> </item> <item> <author>a.huebl@…</author> <pubDate>Mon, 11 Jan 2016 13:15:03 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:6 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:6</guid> <description> <p> Careful with <code>BOOST_WORKAROUND(__CUDACC_VER__, &lt; 70500)</code> please, <code>__CUDACC_VER__</code> is first defined in CUDA 7.5 and will evaluate to <code>undefined</code> in previous versions. I guess <code>BOOST_WORKAROUND</code> will not evaluate to <code>true</code> in such a case. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Mon, 11 Jan 2016 13:50:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:7 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:7</guid> <description> <blockquote class="citation"> <p> Careful with BOOST_WORKAROUND(<span class="underline">CUDACC_VER</span>, &lt; 70500) please, <span class="underline">CUDACC_VER</span> is first defined in CUDA 7.5 and will evaluate to undefined in previous versions. I guess BOOST_WORKAROUND will not evaluate to true in such a case. </p> </blockquote> <p> That's what we want - when <span class="underline">CUDACC_VER</span> is not defined it evaluates as 0 when used in a conditional (std mandated behaviour). So if <span class="underline">CUDACC_VER</span> is either undefined or less than the specified version then !BOOST_WORKAROUND(<span class="underline">CUDACC_VER</span>, &lt; 70500) is false and the variadic template branch is not taken. </p> <p> So 2 questions: </p> <p> 1) Is there any evidence that variadic template support is causing issues elsewhere in Boost? </p> <p> 2) If I update the patch as below, can someone please test it it? </p> <pre class="wiki">index c887a89..2b85a39 100644 --- a/include/boost/type_traits/common_type.hpp +++ b/include/boost/type_traits/common_type.hpp @@ -18,7 +18,7 @@ #include &lt;boost/type_traits/detail/common_type_impl.hpp&gt; #endif -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &amp;&amp; !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &amp;&amp; !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !BOOST_WORKAROUND(__CUDACC_VER__, &lt; 70500) #include &lt;boost/type_traits/detail/mp_defer.hpp&gt; #endif @@ -27,7 +27,7 @@ namespace boost // variadic common_type -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !BOOST_WORKAROUND(__CUDACC_VER__, &lt; 70500) template&lt;class... T&gt; struct common_type { @@ -86,7 +86,7 @@ namespace type_traits_detail #if !defined(BOOST_NO_CXX11_DECLTYPE) -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &amp;&amp; !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) &amp;&amp; !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) &amp;&amp; !BOOST_WORKAROUND(__CUDACC_VER__, &lt; 70500) #if !defined(BOOST_MSVC) || BOOST_MSVC &gt; 1800 </pre> </description> <category>Ticket</category> </item> <item> <author>Alex Grund <a.grund@…></author> <pubDate>Mon, 11 Jan 2016 14:57:23 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:8 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:8</guid> <description> <p> Yes, but the implementation of <code>BOOST_WORKAROUND</code> is: </p> <pre class="wiki"># define BOOST_WORKAROUND(symbol, test) \ ((symbol ## _WORKAROUND_GUARD + 0 == 0) &amp;&amp; \ (symbol != 0) &amp;&amp; (1 % (( (symbol test) ) + 1))) </pre><p> There is a check if that symbol evaluates to <code>0</code> causing the failure I described above. This is why <code>BOOST_WORKAROUND</code> cannot be used for this! </p> <p> So:<br /> 1) Currently not. But similar uses of variadic templates will probably fail. Currently nothing else uses <code>mp_defer</code> (1.60) but other code in future versions may use that as well and run into the same bug.<br /> 2) No because <code>BOOST_WORKAROUND</code> always evaluates to false for this. Prior to 7.5 the symbol is undefined causing the <code>(symbol != 0)</code> check to fail, and in &gt;=7.5 the 2nd part of the check will fail. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 12 Jan 2016 16:43:40 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11897#comment:9 https://svn.boost.org/trac10/ticket/11897#comment:9 <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> OK, I've changed Boost.Config. </p> <p> Please see <a class="ext-link" href="https://github.com/boostorg/config/commit/2090da494ebe0bd79997234a9733191eac425564"><span class="icon">​</span>https://github.com/boostorg/config/commit/2090da494ebe0bd79997234a9733191eac425564</a> and verify that this works for you. </p> Ticket Alex Grund <a.grund@…> Wed, 13 Jan 2016 08:25:28 GMT <link>https://svn.boost.org/trac10/ticket/11897#comment:10 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:10</guid> <description> <p> Tested with CUDA 7.0 and 7.5 and verified that this works </p> <p> Thanks for including the fix </p> </description> <category>Ticket</category> </item> <item> <dc:creator>sharvil</dc:creator> <pubDate>Tue, 19 Jan 2016 09:57:48 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:11 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:11</guid> <description> <p> Apple LLVM version 7.0.2 (clang-700.1.81) is also affected by this. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Tue, 19 Jan 2016 10:06:28 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:12 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:12</guid> <description> <blockquote class="citation"> <p> Apple LLVM version 7.0.2 (clang-700.1.81) is also affected by this. </p> </blockquote> <p> Can you be more specific? Do you mean nvcc on top of clang or just regular clang as shipped by Apple? </p> </description> <category>Ticket</category> </item> <item> <dc:creator>sharvil</dc:creator> <pubDate>Tue, 19 Jan 2016 19:05:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:13 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:13</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/11897#comment:12" title="Comment 12">johnmaddock</a>: </p> <blockquote class="citation"> <blockquote class="citation"> <p> Apple LLVM version 7.0.2 (clang-700.1.81) is also affected by this. </p> </blockquote> <p> Can you be more specific? Do you mean nvcc on top of clang or just regular clang as shipped by Apple? </p> </blockquote> <p> Just regular clang as shipped by Apple. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Michel Morin</dc:creator> <pubDate>Wed, 20 Jan 2016 10:28:14 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:14 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:14</guid> <description> <blockquote class="citation"> <p> Just regular clang as shipped by Apple. </p> </blockquote> <p> With OP's test case, I was not able to reproduce the error on Apple Clang. Do you have a test case? </p> <p> Thanks. </p> <pre class="wiki">$ clang++ --version Apple LLVM version 7.0.2 (clang-700.1.81) Target: x86_64-apple-darwin15.2.0 Thread model: posix $ clang++ -std=c++11 -I boost_1_60_0/ -xc++ - #include &lt;boost/type_traits/common_type.hpp&gt; #include &lt;cstdint&gt; int main(){ boost::common_type&lt;int_least64_t, int_least64_t, intmax_t&gt;::type i; } $ echo $? 0 </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Wed, 20 Jan 2016 10:35:08 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:15 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:15</guid> <description> <p> Regression tests for Clang version 7.0.2 (clang-700.1.81) all seem to be passing as well... </p> </description> <category>Ticket</category> </item> <item> <dc:creator>sharvil</dc:creator> <pubDate>Fri, 22 Jan 2016 02:44:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:16 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:16</guid> <description> <p> Yeah, that test case does work. I'll try to extract the minimum piece of code that triggers this from our project over the weekend. But, we did manage to unblock our builds by disabling variadic templates. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>antar1nd</dc:creator> <pubDate>Mon, 01 Feb 2016 09:11:59 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:17 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:17</guid> <description> <p> On OSX, it can be reproduced if you compile it for objective-c++ . </p> <pre class="wiki">#import &lt;Foundation/Foundation.h&gt; #include &lt;boost/type_traits/common_type.hpp&gt; int main(int argc, const char * argv[]) { boost::common_type&lt;int_least64_t, int_least64_t, intmax_t&gt;::type i; return 0; } </pre><p> Compiling the above results in : </p> <pre class="wiki">$ clang++ -std=c++11 -I boost_1_60_0/ -ObjC++ test.mm In file included from test.mm:2: In file included from boost_1_60_0/boost/type_traits/common_type.hpp:21: boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:28:5: warning: declaration does not declare anything [-Wmissing-declarations] static boost::true_type check(int); ^~~~~~~~~~~~~~~~~~~~~~~ boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:31:5: warning: declaration does not declare anything [-Wmissing-declarations] static boost::false_type check(...); ^~~~~~~~~~~~~~~~~~~~~~~~ boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:33:27: error: use of undeclared identifier 'check' using type = decltype(check&lt;F&gt;(0)); ^ boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:33:33: error: cannot refer to class template 'F' without a template argument list using type = decltype(check&lt;F&gt;(0)); ^ boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:24:35: note: template is declared here template&lt;template&lt;class...&gt; class F, class... T&gt; ^ boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:37:1: error: no type named 'type' in 'boost::type_traits_detail::mp_valid_impl&lt;common_type_fold, long long, long long, long&gt;' using mp_valid = typename mp_valid_impl&lt;F, T...&gt;::type; ^~~~~ boost_1_60_0/boost/type_traits/detail/mp_defer.hpp:50:95: note: in instantiation of template type alias 'mp_valid' requested here template&lt;template&lt;class...&gt; class F, class... T&gt; using mp_defer = typename boost::conditional&lt;mp_valid&lt;F, T...&gt;::value, mp_defer_impl&lt;F, T...&gt;, mp_empty&gt;::type; ^ boost_1_60_0/boost/type_traits/common_type.hpp:47:55: note: in instantiation of template type alias 'mp_defer' requested here struct common_type&lt;T1, T2, T...&gt;: type_traits_detail::mp_defer&lt;type_traits_detail::common_type_fold, T1, T2, T...&gt; ^ test.mm:5:9: note: in instantiation of template class 'boost::common_type&lt;long long, long long, long&gt;' requested here boost::common_type&lt;int_least64_t, int_least64_t, intmax_t&gt;::type i; ^ 2 warnings and 3 errors generated. </pre><p> The root cause is the expansion of a macro "<strong>check</strong>" defined in the OSX_SDK_10.11's <a class="missing wiki">AssertMacros</a>.h . Defining either BOOST_NO_CXX11_TEMPLATE_ALIASES or BOOST_NO_CXX11_VARIADIC_TEMPLATES excludes mp_defer.hpp therefore that works as a workaround. What also works is #undef check before this inclusion. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>antar1nd</dc:creator> <pubDate>Mon, 01 Feb 2016 09:28:33 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:18 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:18</guid> <description> <p> Seems to be fixed in develop : <a class="ext-link" href="https://github.com/boostorg/type_traits/commit/f80cbb0dad16f974815a4ad8208f056ec58c9efc"><span class="icon">​</span>https://github.com/boostorg/type_traits/commit/f80cbb0dad16f974815a4ad8208f056ec58c9efc</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 01 Feb 2016 18:29:37 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:19 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:19</guid> <description> <p> The check macro issue is presumably a whole different issue, but if not then yes, this should be fixed in the next release. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>bchretien</dc:creator> <pubDate>Wed, 05 Oct 2016 15:49:12 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/11897#comment:20 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:20</guid> <description> <p> Apparently the bug is back with CUDA 8.0 (tested with Boost 1.61.0). With the original repro code: </p> <pre class="wiki">$ /usr/local/cuda-7.5/bin/nvcc bug.cu -std=c++11 // No issue $ /usr/local/cuda-8.0/bin/nvcc bug.cu -std=c++11 error: class "boost::common_type&lt;int_least64_t, int_least64_t, intmax_t&gt;" has no member "type" </pre> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Sat, 29 Oct 2016 08:45:34 GMT</pubDate> <title>milestone changed https://svn.boost.org/trac10/ticket/11897#comment:21 https://svn.boost.org/trac10/ticket/11897#comment:21 <ul> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.63.0</span> </li> </ul> <p> You're right - CUDA 8 has the same issue! I've just pushed some changes to Boost.Config develop to fix this. </p> Ticket bchretien Tue, 29 Nov 2016 07:44:41 GMT <link>https://svn.boost.org/trac10/ticket/11897#comment:22 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11897#comment:22</guid> <description> <p> I forwarded the issue to the NVIDIA developers, they fixed the problem for the next CUDA release. </p> </description> <category>Ticket</category> </item> </channel> </rss>