Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
107 views
in Technique[技术] by (71.8m points)

c++ - Compiler Error with function template specialization

I'm using a class literal template that's basically defined as:

struct A {
public:
   const std::size_t size1, size2, size3;
}

I've made an instance of this with

constexpr A AInst = {1, 2, 1};

I then have a templated function that uses a size from the literal:

template<A a>
static void func(int arg1, double (*arg2)[a.size1]);

When I go to specialize this function I just get: "Internal compiler error." (using MSVC)

template<>
static void func<AInst>(int arg1, double (*arg2)[AInst.size1]){ /* implementation */}
question from:https://stackoverflow.com/questions/65839797/compiler-error-with-function-template-specialization

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...