https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78906
Bug ID: 78906 Summary: ICE with a member variable template whose type is a decltype of a member variable template of a class template Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ville.voutilainen at gmail dot com Target Milestone: --- template <typename> struct A { static constexpr int digits = 0; }; template <typename> struct B { template <int, typename MaskInt = int, int = A<MaskInt>::digits> static constexpr int XBitMask = 0; }; struct C { using ReferenceHost = B<int>; template <int> static decltype(ReferenceHost::XBitMask<0>) XBitMask; }; int main() { C::XBitMask<0>; } prog.cc:8:62: internal compiler error: Segmentation fault template <int> static decltype(ReferenceHost::XBitMask<0>) XBitMask; ^~~~~~~~ 0xb04b0f crash_signal /home/heads/gcc/gcc-source/gcc/toplev.c:333 0x615d7c tsubst(tree_node*, tree_node*, int, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:13172 0x622612 tsubst_template_args /home/heads/gcc/gcc-source/gcc/cp/pt.c:11415 0x622ebc tsubst_aggr_type /home/heads/gcc/gcc-source/gcc/cp/pt.c:11618 0x616399 tsubst(tree_node*, tree_node*, int, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:13098 0x62288b tsubst_qualified_id /home/heads/gcc/gcc-source/gcc/cp/pt.c:13979 0x625f41 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:16550 0x61af77 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:16146 0x62039c coerce_template_parms /home/heads/gcc/gcc-source/gcc/cp/pt.c:7801 0x620c83 finish_template_variable(tree_node*, int) /home/heads/gcc/gcc-source/gcc/cp/pt.c:8782 0x620dc6 lookup_and_finish_template_variable /home/heads/gcc/gcc-source/gcc/cp/pt.c:8820 0x6229a9 tsubst_qualified_id /home/heads/gcc/gcc-source/gcc/cp/pt.c:14046 0x625f41 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:16550 0x615e51 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:13750 0x615e51 tsubst(tree_node*, tree_node*, int, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:13750 0x6231fc tsubst_decl /home/heads/gcc/gcc-source/gcc/cp/pt.c:12511 0x61656f tsubst(tree_node*, tree_node*, int, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:13016 0x6159cb instantiate_template_1 /home/heads/gcc/gcc-source/gcc/cp/pt.c:17811 0x6159cb instantiate_template(tree_node*, tree_node*, int) /home/heads/gcc/gcc-source/gcc/cp/pt.c:17867 0x6c0cba finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int) /home/heads/gcc/gcc-source/gcc/cp/semantics.c:3689 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.