4

Having the code snippet below (under C++17 standard):

template <class ...TParams>
class Wrapper {
public:
    template <template <class, TParams...> class TTemplate, class TValue, TParams ...params>
    class Base {
    public:
        TTemplate<TValue, params...> value;
    };
};
template <class T, bool Param1, int Param2>
class Class {
public:
    T value;
    bool boolean = Param1;
    int integer = Param2;
};
template <class T, bool Param1, int Param2>
class Derived :public Wrapper<bool, int>::Base<Class, T, Param1, Param2> {};
int main() {
    Derived<int,true,0> test;
    return 0;
}

MSVC fails to compile, saying "the template parameter list for class template 'Class' does not match the template parameter list for template parameter 'TTemplate'"
May anyone explain the reason why Class doesn't match TTemplate? Thanks in advance.

5
  • clang 12.0.0 has no problem with this code Commented Nov 25, 2020 at 14:44
  • @drompix gcc, up to and including trunk rejects the code. But with a different error. Commented Nov 25, 2020 at 14:45
  • 1
    @cigien MSVC and c++17, updated in problem description Commented Nov 25, 2020 at 14:47
  • @true_mogician take a look at this stackoverflow.com/questions/50656291/… Commented Nov 25, 2020 at 14:49
  • @drompix Kind of different, this questioner want a type template in template, but I'm trying for a template with variadic non-type parameters in template Commented Nov 25, 2020 at 14:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.