This is gcc bug 80871. The issue is, we end up with this set of candidates for deduction:
template <class... Types, class... Args>
list<Types...> __f(Args... ); // constructor
template <class... Args>
list<Args...> __f(Args... ); // deduction-guide
Both are valid (Types...
can deduce as empty in the first case), but the call here should be ambiguous – neither is more specialized than the other. Types...
does not participate in ordering here (similar to the example in [temp.deduct.partial]/12). So the correct behavior is to proceed to the next tiebreaker, which favors deduction-guides. Hence, this should be a list<int, double, char>
.
However, gcc’s behavior is to favor the constructor, hence the static_assert
triggers becuase Types...
would indeed be empty in that situation.