llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

clang: regression - template partial specialization with integer_sequence

Open elbeno opened this issue 1 year ago • 3 comments

Partial specialization of a template with an integer sequence or similar seems to be failing.

#include <utility>

template <typename L> struct S;

template <template <typename, auto...> typename L, typename T, T... Vs>
struct S<L<T, Vs...>> {
    constexpr static auto value = 0;
};

auto main() -> int {
    using T = std::make_index_sequence<3>;
    return S<T>::value;
}

https://godbolt.org/z/GY9M44nzM

Produces:

<source>:12:12: error: implicit instantiation of undefined template 'S<std::integer_sequence<unsigned long, 0, 1, 2>>'
   12 |     return S<T>::value;
      |            ^

This seems to be a regression after clang-19.

elbeno avatar Mar 14 '25 21:03 elbeno

CC @zyn0217

shafik avatar Mar 14 '25 21:03 shafik

@llvm/issue-subscribers-clang-frontend

Author: Ben Deane (elbeno)

Partial specialization of a template with an integer sequence or similar seems to be failing.
#include &lt;utility&gt;

template &lt;typename L&gt; struct S;

template &lt;template &lt;typename, auto...&gt; typename L, typename T, T... Vs&gt;
struct S&lt;L&lt;T, Vs...&gt;&gt; {
    constexpr static auto value = 0;
};

auto main() -&gt; int {
    using T = std::make_index_sequence&lt;3&gt;;
    return S&lt;T&gt;::value;
}

https://godbolt.org/z/GY9M44nzM

Produces:

&lt;source&gt;:12:12: error: implicit instantiation of undefined template 'S&lt;std::integer_sequence&lt;unsigned long, 0, 1, 2&gt;&gt;'
   12 |     return S&lt;T&gt;::value;
      |            ^

This seems to be a regression after clang-19.

llvmbot avatar Mar 14 '25 21:03 llvmbot

Looks like #130778. See https://github.com/llvm/llvm-project/issues/130992#issuecomment-2718890171 for a fix.

MagentaTreehouse avatar Mar 15 '25 00:03 MagentaTreehouse