NVCC bug with gcc7

I have the following code and it has an error only with cuda9 + gcc7. Cuda9 + gcc6 doesn’t have compilation. This is a minimal reproducer I wrote for the error. I suspect it is a compiler error but I have to fix my code to work with gcc7. I want to know a workaround to get rid of the compilation error.

Cuda compilation tools, release 9.2, V9.2.148

gcc version 7.3.0 (Ubuntu 7.3.0-21ubuntu1~16.04)

Error:

$ nvcc test.cu
test.h: In constructor ‘TestOp::TestOp()’:
test.h:6:54: error: ‘Dummy’ is not a member of ‘TestOp’

//op.h

class OperatorBase {
public:
template
inline bool Dummy(T default_value) {
return true;
}
};

template <class Context>
class Operator : public OperatorBase {
};

//test.cu

#include “test.h”


//test.h

#include “op.h”
template
class TestOp : public Operator {
public:
TestOp()
: msg_(
OperatorBase::Dummy(true)) {}

private:
bool msg_;
};

To me it looks like that (in test.cu) class OperatorBase should have an explicit instantiation
of the Dummy() templated member function with the type T being a bool.

an answer is now available on the cross posting:

[url]c++ - NVCC bug with gcc7 - Stack Overflow