https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121117
Bug ID: 121117 Summary: Wrong overload resolution for function templates with packs Product: gcc Version: 16.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tobias.loew at steag dot com Target Milestone: --- Please ave a look at https://godbolt.org/z/PsTEz4Ks1 acc. to the current standard draft at eel.is the overload template< typename ...Ts > int foo( tag_special, Ts&& ... ts ) {...} should be selected. In detail: According to https://eel.is/c++draft/temp.deduct#partial-8 the P/A pairs are matched for all 5 arguments (for type-packs the arguments A are matched against the declarator-id of the pack). This will order the overload void foo(tag_special, Ts&& ... ts) as better (and not equal) than the other (for the first argument the type tag_special is more specialized than a forwarding reference.). Therefore this overload should be called. Please note, that https://eel.is/c++draft/temp.deduct#partial-8 does not say anything about prefering non-pack types over packs: In the original version from the C++11 standard, this paragraph started with the sentence If A was transformed from a function parameter pack and P is not a parameter pack, type deduction fails. But this tie-breaker for packs vs non-packs moved to https://eel.is/c++draft/temp.deduct#partial-11, which only applies if all cases before ended with a draw. Furthermore, I think that the Example in paragraph 8 is misleading and obsolete and should be moved to paragraph 11.