
Hi all,
I'm trying to compile boost::numeric::ublas with NVCC and I get the
following errors:
/usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: `&'
cannot appear in a constant-expression
/usr/local/include/boost/type_traits/has_new_operator.hpp:28: error:
template argument 2 is invalid
This is related to #3919 and #3980 in a effort to make NVCC work with
boost.
Is there a known workaround so that I could tweak
boost/config/compiler/nvcc.hpp?
I'm using trunk under linux with the following piece of code:
// Boost headers
#include

Denis Taniguchi wrote:
Hi all,
I'm trying to compile boost::numeric::ublas with NVCC and I get the following errors:
/usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: `&' cannot appear in a constant-expression /usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: template argument 2 is invalid
This is related to #3919 and #3980 in a effort to make NVCC work with boost. Is there a known workaround so that I could tweak boost/config/compiler/nvcc.hpp? I'm using trunk under linux with the following piece of code:
I will give it a look monday when I have acces to our GPU machine. I think it's related to nvcc support for template, especially SFINAE. -- ___________________________________________ Joel Falcou - Assistant Professor PARALL Team - LRI - Universite Paris Sud XI Tel : (+33)1 69 15 66 35

On Sat, 2010-03-27 at 16:53 +0100, joel falcou wrote:
Denis Taniguchi wrote:
Hi all,
I'm trying to compile boost::numeric::ublas with NVCC and I get the following errors:
/usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: `&' cannot appear in a constant-expression /usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: template argument 2 is invalid
This is related to #3919 and #3980 in a effort to make NVCC work with boost. Is there a known workaround so that I could tweak boost/config/compiler/nvcc.hpp? I'm using trunk under linux with the following piece of code:
I will give it a look monday when I have acces to our GPU machine. I think it's related to nvcc support for template, especially SFINAE.
Looks like it's treating SFINAE correctly, at least for release 3.0 of NVCC (code from Wikipedia): #include <iostream> struct Test { typedef int Type; }; template < typename T > void f(typename T::Type) // definition #1 { std::cerr << "definition #1" << std::endl; } template < typename T > void f(T) // definition #2 { std::cerr << "definition #2" << std::endl; } int main() { f<Test>(10); // call #1 f<int>(10); // call #2 without error thanks to SFINAE return 0; } Returns: definition #1 definition #2

On Sat, 2010-03-27 at 16:53 +0100, joel falcou wrote:
Denis Taniguchi wrote:
Hi all,
I'm trying to compile boost::numeric::ublas with NVCC and I get the following errors:
/usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: `&' cannot appear in a constant-expression /usr/local/include/boost/type_traits/has_new_operator.hpp:28: error: template argument 2 is invalid
This is related to #3919 and #3980 in a effort to make NVCC work with boost. Is there a known workaround so that I could tweak boost/config/compiler/nvcc.hpp? I'm using trunk under linux with the following piece of code:
I will give it a look monday when I have acces to our GPU machine. I think it's related to nvcc support for template, especially SFINAE.
Removing boost/type_traits/has_new_operator.hpp in type_traits.hpp solved the problem (obviously). Index: type_traits.hpp =================================================================== --- type_traits.hpp (revision 60920) +++ type_traits.hpp (working copy) @@ -16,7 +16,7 @@ #include "boost/type_traits/add_reference.hpp" #include "boost/type_traits/add_volatile.hpp" #include "boost/type_traits/alignment_of.hpp" -#ifndef __BORLANDC__ +#if !defined(__BORLANDC__) && !defined(__CUDACC__) #include "boost/type_traits/has_new_operator.hpp" #endif #include "boost/type_traits/has_nothrow_assign.hpp"
participants (2)
-
Denis Taniguchi
-
joel falcou