'Why does this code no longer compile when the concept is made variadic?
Let's define the following templates:
template<typename> concept C_one = true;
template<typename...> concept C_many = true;
template<bool> struct S { };
Now, let's try to use them.
This line compiles:
template<typename T = S<C_one<int>>> void f() { }
And this one does not:
template<typename T = S<C_many<int>>> void f() { }
The error I'm getting is:
error: type/value mismatch at argument 1 in template parameter list for 'template<bool <anonymous> > struct S'
I noticed that wrapping C_many<int> in parentheses fixes the issue, but what is the reason for such seemingly inconsistent syntax? I think the error message isn't very helpful either.
Also, I am aware that this might be a pretty contrived example, because I tried to create a minimal reproducible example.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
