For the following code:

template<class... Parameter> struct Outer
{
    template<Parameter... Value> struct Inner
    {
        static bool Member;
    };
};

template<class... Parameter>
template<Parameter... Value>
bool Outer<Parameter...>::Inner<Value...>::Member = true;

int main()
{
    Outer<int>::Inner<0>::Member = false;
    return 0;
}

GCC 7.3.0 reports:

error: expansion pattern 'Value' contains no argument packs
 bool Outer<Parameter...>::Inner<Value...>::Member = true;

and Visual Studio 16.7.2, simlarly, about the same Value parameter pack:

error C3546: '...': there are no parameter packs available to expand

Both compilers succeed, if in the same code Parameter is not a parameter pack, or Value is not dependent on Parameter.

Why are those errors occurring? Does this case require some special syntax?

I know that since c++17 it can be solved by defining the member inside the class with the inline keyword. However I would prefer my code to be compatible with c++11, if it's possible.

0

There are 0 best solutions below