https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95287

--- Comment #4 from Raul Tambre <raul at tambre dot ee> ---
Per Richard Smith's comment here [0], which I think has basically slightly more
complicated examples of this same problem, this is valid. While pathological,
his explanation makes sense to me. He's also the one that submitted DR2233.

I think the key piece here is 7.6.1.3p4 in DR2233: "when a function is called".
j<int> can't be called without overriding the first parameter so it's not
invalid despite it inheriting a default argument for i and thus requiring also
values for the others.

Thus [1]:
1. j() calls the parameter pack one
2. j(1) calls the parameter pack one
3. j(1, 2) calls the specialization because it specializes the parameter pack
just being a single int
4. j(1, 2, 3) calls the parameter pack one

Though this wording is different in the latest expr.call#6 [2] and doesn't
mention being ill-formed. But I'm not too great with the legalese.

[0] https://reviews.llvm.org/D79800#2058985
[1] https://godbolt.org/z/4bKTojKde
[2] https://eel.is/c++draft/expr.call#6

Reply via email to