Tested on GCC 14.0.0 20231119 (on Compiler-Explorer) and it's giving me ICE, also on all 13.x versions (not 12.x) ```c++ template <class> constexpr bool dependent_true = true; template <bool> struct empty_type { }; // something like enable_if template <bool B> using empty_type_t = typename empty_type<B>::type; struct wrapper { using type = void; }; template <class...> using all = wrapper; template <class... Conditions> using constraints = typename all<Conditions...>::type; template <typename T, constraints<empty_type_t<dependent_true<T>>> = nullptr> void calculate() { }; ``` I don't even need to instantiate `calculate` function. It gives me this error: <source>: In substitution of 'template<class ... Conditions> using constraints = typename all<Conditions ...>::type [with Conditions = {typename empty_type<dependent_true<T> >::type}]': <source>:16:66: required from here 16 | template <typename T, constraints<empty_type_t<dependent_true<T>>> = nullptr> | ^ <source>:14:7: internal compiler error: Segmentation fault 14 | using constraints = typename all<Conditions...>::type; | ^~~~~~~~~~~ 0x26a742e internal_error(char const*, ...) ???:0 0xd276f0 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xd1b8f3 instantiate_template(tree_node*, tree_node*, int) ???:0 0xd285ea tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0xd35ed6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) ???:0 0xd6996f finish_template_type(tree_node*, tree_node*, int) ???:0 0xcf6a49 c_parse_file() ???:0 0xe38e79 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1
Confirmed, note this is not related to variadic templates as this crashes in a similar way: ``` template <class> constexpr bool dependent_true = true; template <bool> struct empty_type { }; // something like enable_if template <bool B> using empty_type_t = typename empty_type<B>::type; struct wrapper { using type = void; }; template <class> using all = wrapper; template <class Conditions> using constraints = typename all<Conditions>::type; template <typename T, constraints<empty_type_t<dependent_true<T>>> = nullptr> void calculate() { }; ```
.
Started with r13-4729-gbe124477b38a71
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:3f266c84a15d63e42bfad46397fea9aff92b0720 commit r14-5763-g3f266c84a15d63e42bfad46397fea9aff92b0720 Author: Patrick Palka <ppalka@redhat.com> Date: Wed Nov 22 13:54:29 2023 -0500 c++: alias template of non-template class [PR112633] The entering_scope adjustment in tsubst_aggr_type assumes if an alias is dependent, then so is the aliased type (and therefore it has template info) but that's not true for the dependent alias template specialization ty1<T> below which aliases the non-template class A. In this case no adjustment is needed anyway, so we can just punt. PR c++/112633 gcc/cp/ChangeLog: * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO in the entering_scope adjustment. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-75.C: New test.
Thanks for really quick fix! You are awesome!
The releases/gcc-13 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>: https://gcc.gnu.org/g:63c65224e778124eee52acc7b9fcb32cd8ad61e8 commit r13-8090-g63c65224e778124eee52acc7b9fcb32cd8ad61e8 Author: Patrick Palka <ppalka@redhat.com> Date: Wed Nov 22 19:07:19 2023 -0500 c++: alias template of non-template class [PR112633] The entering_scope adjustment in tsubst_aggr_type assumes if an alias is dependent, then so is the aliased type (and therefore it has template info) but that's not true for the dependent alias template specialization ty1<T> below which aliases the non-template class A. In this case no adjustment is needed anyway, so we can just punt. PR c++/112633 gcc/cp/ChangeLog: * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO in the entering_scope adjustment. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-75.C: New test. (cherry picked from commit 3f266c84a15d63e42bfad46397fea9aff92b0720)
Fixed for GCC 13.3, thanks for the bug report.