https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83727
Bug ID: 83727 Summary: [8 Regression] ICE (Segmentation fault) in local_class_index Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: doko at gcc dot gnu.org Target Milestone: --- seen with r256272, building kakoune $ cat normal.ii namespace a { template <typename b, int c> b *begin(b (&)[c]); } class d { public: d(const char *); }; struct e { int f; d docstring; void (*func)(int &, int); }; namespace a { template <typename h, typename g> h i(h, h, g) { return 0; } } using a::begin; template <typename j, typename k> auto i(j &&container, k l) -> decltype(begin(container)) { return a::i(container, container, l); } enum { m }; template <int> void n(int &, int) { [] { struct p { } o[]{{}}; i(o, p{}); }; } e cmds{'i', "", n<m>}; $ g++ -std=gnu++11 -c -O0 normal.ii normal.ii: In instantiation of 'decltype (a::begin(container)) i(j&&, k) [with j = n(int&, int)::<lambda()> [with int <anonymous> = 0]::p (&)[1]; k = n(int&, int)::<lambda()> [with int <anonymous> = 0]::p]': normal.ii:18:6: required from here normal.ii:18:6: internal compiler error: Segmentation fault auto i(j &&container, k l) -> decltype(begin(container)) { ^ 0x8803dda crash_signal ../../src/gcc/toplev.c:325 0x834effb local_class_index ../../src/gcc/cp/mangle.c:1925 0x83515a6 discriminator_for_local_entity ../../src/gcc/cp/mangle.c:1957 0x83515a6 write_local_name ../../src/gcc/cp/mangle.c:2058 0x83515a6 write_name ../../src/gcc/cp/mangle.c:964 0x8353698 write_encoding ../../src/gcc/cp/mangle.c:825 0x8351427 write_local_name ../../src/gcc/cp/mangle.c:2027 0x8351427 write_name ../../src/gcc/cp/mangle.c:964 0x8351ded write_class_enum_type ../../src/gcc/cp/mangle.c:2809 0x8351ded write_type ../../src/gcc/cp/mangle.c:2222 0x8352595 write_array_type ../../src/gcc/cp/mangle.c:3599 0x8352595 write_type ../../src/gcc/cp/mangle.c:2146 0x8351f05 write_type ../../src/gcc/cp/mangle.c:2303 0x8356b9b write_template_args ../../src/gcc/cp/mangle.c:2838 0x8351334 write_name ../../src/gcc/cp/mangle.c:933 0x8353698 write_encoding ../../src/gcc/cp/mangle.c:825 0x8357244 mangle_decl_string ../../src/gcc/cp/mangle.c:3791 0x835743d get_mangled_id ../../src/gcc/cp/mangle.c:3813 0x835743d mangle_decl(tree_node*) ../../src/gcc/cp/mangle.c:3851 0x89d1886 decl_assembler_name(tree_node*) ../../src/gcc/tree.c:687 Please submit a full bug report, with preprocessed source if appropriate.