https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93400
Bug ID: 93400 Summary: [10 Regression] ICE: in tsubst, at cp/pt.c:15142 on friends with concepts Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gcc-bugs at marehr dot dialup.fu-berlin.de Target Milestone: --- The following code ICEs on a recent gcc-10 build, but worked in gcc 9 and below: ``` template <typename> bool a = true; template <typename i> concept b = a<i>; template <int> struct f { template <b c> friend auto g(c, f); }; auto d = f<1>{}; auto e = f<0>{}; ``` https://godbolt.org/z/A5xXyR With the following error: ``` > g++-git -std=c++2a -c ice.cpp // and -std=c++17 -fconcepts ice.cpp: In instantiation of ‘struct f<0>’: ice.cpp:5:15: required from here ice.cpp:3:54: internal compiler error: in tsubst, at cp/pt.c:15142 3 | template <int> struct f { template <b c> friend auto g(c, f); }; | ^ 0x602fb4 tsubst(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:15142 0x7723f5 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:13125 0x76a73c tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:19022 0x7630c4 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18955 0x7630c4 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:18590 0x6825f6 tsubst_constraint(tree_node*, tree_node*, int, tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/constraint.cc:2349 0x781d6f tsubst_friend_function /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:10846 0x781d6f instantiate_class_template_1 /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:11975 0x7823e2 instantiate_class_template(tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/pt.c:12040 0x7b242d complete_type(tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/typeck.c:137 0x7b242d complete_type(tree_node*) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/typeck.c:111 0x790cb9 finish_compound_literal(tree_node*, tree_node*, int, fcl_t) /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/semantics.c:2929 0x71cf1d cp_parser_functional_cast /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:29405 0x734044 cp_parser_postfix_expression /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:7134 0x718aca cp_parser_binary_expression /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:9508 0x71a12c cp_parser_assignment_expression /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:9813 0x71927d cp_parser_constant_expression /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:10107 0x7197e1 cp_parser_initializer_clause /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:23108 0x71d04f cp_parser_initializer /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:23046 0x742b94 cp_parser_init_declarator /home/marehr/Packages/gcc-git/src/gcc/gcc/cp/parser.c:20752 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://bugs.archlinux.org/> for instructions. ``` gcc version being: ``` g++-git -v Using built-in specs. COLLECT_GCC=g++-git COLLECT_LTO_WRAPPER=/opt/gcc/gcc-git/bin/../lib/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/marehr/Packages/gcc-git/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++ --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto --disable-boostrap Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.0.1 20200123 (experimental) (GCC) ```