https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78334
Bug ID: 78334 Summary: unpacking constexpr char array as template parameters list inside constexpr lambda failed when passed as auto non-type template parameter Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: tomilovanatoliy at yandex dot ru Target Milestone: --- Created attachment 40031 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40031&action=edit source file I tried to unpack constexpr char array to template parameters list using constexpr lambda (see attached code) and gives internal compiler error described below. Technically I can do it, if I use `template< std::size_t size, char const (& value)[size] >` template parameter pack for variable template. I.e. the problem triggered namely by `auto const &` template non-type parameter. Version: 7.0.0 20161112 System type: x86_64-pc-linux-gnu Command line: $ g++ prog.cc -Wall -Wextra -v -I/usr/local/boost-1.62.0/include -std=gnu++1z -pedantic "-Wall" "-Wextra" Output of the compiler: Using built-in specs. COLLECT_GCC=/usr/local/gcc-head/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /home/heads/gcc/gcc-source/configure --prefix=/usr/local/gcc-head --enable-languages=c,c++ --enable-lto --disable-multilib --without-ppl --without-cloog-ppl --enable-checking=release --disable-nls Thread model: posix gcc version 7.0.0 20161112 (experimental) (GCC) COLLECT_GCC_OPTIONS='-o' 'prog.exe' '-I' '/usr/local/boost-sml/include' '-I' '/usr/local/range-v3/include' '-Wpedantic' '-std=gnu++1z' '-I' '/usr/local/boost-1.62.0/include' '-L/usr/local/boost-1.62.0/lib' '-v' '-Wall' '-Wextra' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/gcc-head/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/cc1plus -quiet -v -I /usr/local/boost-sml/include -I /usr/local/range-v3/include -I /usr/local/boost-1.62.0/include -imultiarch x86_64-linux-gnu -D_GNU_SOURCE prog.cc -quiet -dumpbase prog.cc -mtune=generic -march=x86-64 -auxbase prog -Wpedantic -Wall -Wextra -std=gnu++1z -version -o /tmp/ccZUTC1X.s GNU C++14 (GCC) version 7.0.0 20161112 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.0.0 20161112 (experimental), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1, isl version none warning: GMP header version 5.1.2 differs from library version 5.0.2. warning: MPFR header version 3.1.2 differs from library version 3.1.0-p3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/local/gcc-head/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../x86_64-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/boost-sml/include /usr/local/range-v3/include /usr/local/boost-1.62.0/include /usr/local/gcc-head/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0 /usr/local/gcc-head/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0/x86_64-pc-linux-gnu /usr/local/gcc-head/lib/gcc/x86_64-pc-linux-gnu/7.0.0/../../../../include/c++/7.0.0/backward /usr/local/gcc-head/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include /usr/local/include /usr/local/gcc-head/include /usr/local/gcc-head/lib/gcc/x86_64-pc-linux-gnu/7.0.0/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. GNU C++14 (GCC) version 7.0.0 20161112 (experimental) (x86_64-pc-linux-gnu) compiled by GNU C version 7.0.0 20161112 (experimental), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1, isl version none warning: GMP header version 5.1.2 differs from library version 5.0.2. warning: MPFR header version 3.1.2 differs from library version 3.1.0-p3. GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 Compiler executable checksum: ceca72188b7a96c7095801870930d855 prog.cc: In instantiation of 'struct<lambda>': prog.cc:51:64: required from 'constexpr const auto constexpr_string<s>' prog.cc:59:44: required from here prog.cc:51:80: internal compiler error: Segmentation fault constexpr auto constexpr_string = iterate< std::size(value) >{}([] (auto... i) constexpr { return std::integer_sequence< char_type, value[i]... >{}; }); ^~~~~~~~~ 0xaf5f3f crash_signal /home/heads/gcc/gcc-source/gcc/toplev.c:338 0x604f00 template_parms_to_args /home/heads/gcc/gcc-source/gcc/cp/pt.c:4302 0x609ca5 current_template_args /home/heads/gcc/gcc-source/gcc/cp/pt.c:4330 0x609ca5 do_auto_deduction(tree_node*, tree_node*, tree_node*, int, auto_deduction_context, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:24880 0x61ad96 convert_template_argument /home/heads/gcc/gcc-source/gcc/cp/pt.c:7304 0x61e786 coerce_template_parms /home/heads/gcc/gcc-source/gcc/cp/pt.c:7794 0x61f5b9 lookup_template_class_1 /home/heads/gcc/gcc-source/gcc/cp/pt.c:8366 0x61f5b9 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*, int, int) /home/heads/gcc/gcc-source/gcc/cp/pt.c:8711 0x620e29 tsubst_aggr_type /home/heads/gcc/gcc-source/gcc/cp/pt.c:11592 0x613353 tsubst_decl /home/heads/gcc/gcc-source/gcc/cp/pt.c:11957 0x618ee7 tsubst(tree_node*, tree_node*, int, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:12984 0x612960 tsubst_decl /home/heads/gcc/gcc-source/gcc/cp/pt.c:11818 0x618ee7 tsubst(tree_node*, tree_node*, int, tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:12984 0x626ce1 instantiate_class_template_1 /home/heads/gcc/gcc-source/gcc/cp/pt.c:10153 0x626ce1 instantiate_class_template(tree_node*) /home/heads/gcc/gcc-source/gcc/cp/pt.c:10487 0x688fa5 complete_type(tree_node*) /home/heads/gcc/gcc-source/gcc/cp/typeck.c:133 0x616880 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:17419 0x617174 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:16733 0x610fff tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:16043 0x60e4db tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/heads/gcc/gcc-source/gcc/cp/pt.c:21897 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.