0

我正在尝试使 nvcc (g++/EDG) 与最新的提升很好地配合

template<typename U>                                        \
   static false_type has_member(tester<&U::member_name>*); \

/opt/boost/include/boost/thread/locks.hpp:65: error: ‘&amp;’ cannot appear in a constant-expression
/opt/boost/include/boost/thread/locks.hpp:65: error: template argument 1 is invalid

知道如何解决吗?

4

1 回答 1

1

你用的是什么版本的nvcc?

我尝试在以下更简单的情况下重现错误,但编译成功(CUDA 3.2):

#include <stdio.h>

class Test {
public:
    int x;
};

template <int Test::*S>
class Template {
};

template <typename T>
class Run {
    Template<&T::x> foo;
};

int main() {
    Run<Test> foo;
}
于 2011-03-01T21:43:55.357 回答