-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Compiler crashes on partial specialization of variable template with template template parameter #34301
Comments
Here's a very slightly refined version of the first test case. It appears that swapping the order in which the template parameters are passed to the variable template is what causes the crash. The following works fine. template <typename... param_types>
struct is_specified_instantiation_of {
template <template <param_types...> class container, typename T>
static constexpr bool value = false;
template <template <param_types...> class container, param_types... params>
static constexpr bool value<container, container<params...>> = true;
};
template <bool, bool>
struct bool_pair {};
int main () {
static_assert(is_specified_instantiation_of<bool, bool>::template value<bool_pair, bool_pair<true, false>>, "");
} Whereas the following crashes with trunk template <typename... param_types>
struct is_specified_instantiation_of {
template <typename T, template <param_types...> class container>
static constexpr bool value = false;
template <template <param_types...> class container, param_types... params>
static constexpr bool value<container<params...>, container> = true;
};
template <bool, bool>
struct bool_pair {};
int main () {
static_assert(is_specified_instantiation_of<bool, bool>::template
value<bool_pair<true, false>, bool_pair>, "");
} |
This still reproduces on post 16 trunk (12e9c7a)
The code is
The full backtrace is
|
@llvm/issue-subscribers-clang-frontend |
I ran into the same assertion while reducing #77250 (https://godbolt.org/z/sxeoj751E): auto __make_tuple = []<class... _Captures >(_Captures...) {
return []< class _Fun >( _Fun) -> void
requires requires { 0; }
{};
};
template < class, class _As >
using __call_result_t = decltype(__make_tuple(0)(_As{}));
using T = __call_result_t< int, int >; Clang 20.0 crash:
|
@Endilll the new reduction looks like a regression: https://godbolt.org/z/Wj9zeKd8c |
I believe this is passing on 19.1.0 and trunk now: https://godbolt.org/z/bf8MjG5Yj |
Extended Description
This template is valid, and does compile with clang 3.9 and clang 5.0, but not with clang 4 or trunk. Trunk crashes, and clang 4 gives an error.
See also https://godbolt.org/g/NGQNCm.
Second similar example with structs further down.
To the best of my knowledge, both examples should be fine.
A related example that compiles with 3.8 but either fails or crashes with later (crashes with trunk, see also https://godbolt.org/g/ZyTERb)
The text was updated successfully, but these errors were encountered: