https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120500
Bug ID: 120500
Summary: Template argument deduction fails when using a
template-member-function of a template-type with the
same fixed sequence
Product: gcc
Version: 15.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pro.guillaume.dua at gmail dot com
Target Milestone: ---
The following MVE fails to compile on GCC, while Clang and MSVC accept it.
(See it here on godbolt https://godbolt.org/z/7GzGhKx3n)
#include <utility>
template <std::size_t I, typename T>
struct Leaf{};
template <typename Seq>
struct S;
template <std::size_t...Is>
struct S<std::index_sequence<Is...>>
{
template <typename... Ts>
S(Leaf<Is, Ts>...) {}
};
int main() {
[[maybe_unused]] S<std::make_index_sequence<2>> s{
Leaf<0, char>{}, Leaf<1, int>{}
};
}
Also, changing the S constructor to
template <std::size_t ... Js, typename... Ts>
S(Leaf<Js, Ts>...) {}
make it compile.
Same MVE, but using a non-constructor member function, and a TTPs instead of an
index_sequence: https://godbolt.org/z/osb48T7nx