https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90172

            Bug ID: 90172
           Summary: [9 Regression] ICE: Segmentation fault (in
                    contains_struct_check)
           Product: gcc
           Version: 9.0
            Status: UNCONFIRMED
          Keywords: error-recovery
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
  Target Milestone: ---

g++-9.0.0-alpha20190414 snapshot (r270355) ICEs when compiling the following
testcase extracted from test/SemaCXX/cxx1y-generic-lambdas.cpp from the clang
8.0.0 test suite w/ -std=c++17:

template<class ... Ts> int fooV(Ts ... ts) {
  auto L = [](auto ... a) {
    auto M = [](decltype(a) ... b) -> void {
    };
    return M;
  };

  decltype(L(L, ts...)) (*fp)(decltype(L), decltype(ts) ...) = L;

  return 0;
}

int run2 = fooV("BC", 3, 2.77, 'A', float{}, short{}, unsigned{});

% g++-9.0.0-alpha20190414 -std=c++17 -c mziudrma.cpp
mziudrma.cpp: In instantiation of 'int fooV(Ts ...) [with Ts = {const char*,
int, double, char, float, short int, unsigned int}]':
mziudrma.cpp:13:65:   required from here
mziudrma.cpp:3:14: error: expansion pattern 'decltype (#'nontype_argument_pack'
not supported by dump_expr#<expression error>)' contains no parameter packs
    3 |     auto M = [](decltype(a) ... b) -> void {
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4 |     };
      |     ~         
mziudrma.cpp: In instantiation of 'static constexpr decltype (((const fooV(Ts
...) [with Ts = {const char*, int, double, char, float, short int, unsigned
int}]::<lambda(auto:1 ...)>*)0)->operator()<auto:1
...>(static_cast<auto:1&>(fooV::__lambda2::_FUN::<unnamed>) ...)) fooV(Ts ...)
[with Ts = {const char*, int, double, char, float, short int, unsigned
int}]::<lambda(auto:1 ...)>::_FUN(auto:1 ...) [with auto:1 = {fooV(Ts ...)
[with Ts = {const char*, int, double, char, float, short int, unsigned
int}]::<lambda(auto:1 ...)>, const char*, int, double, char, float, short int,
unsigned int}; decltype (((const fooV(Ts ...) [with Ts = {const char*, int,
double, char, float, short int, unsigned int}]::<lambda(auto:1
...)>*)0)->operator()<auto:1
...>(static_cast<auto:1&>(fooV::__lambda2::_FUN::<unnamed>) ...)) = void]':
mziudrma.cpp:2:12:   required from 'constexpr fooV(Ts ...) [with Ts = {const
char*, int, double, char, float, short int, unsigned int}]::<lambda(auto:1
...)>::operator decltype (((const fooV(Ts ...) [with Ts = {const char*, int,
double, char, float, short int, unsigned int}]::<lambda(auto:1
...)>*)0)->operator()<auto:1
...>(static_cast<auto:1&>(fooV::__lambda2::_FUN::<unnamed>) ...)) (*)(auto:1
...)() const [with auto:1 = {fooV(Ts ...) [with Ts = {const char*, int, double,
char, float, short int, unsigned int}]::<lambda(auto:1 ...)>, const char*, int,
double, char, float, short int, unsigned int}; decltype (((const fooV(Ts ...)
[with Ts = {const char*, int, double, char, float, short int, unsigned
int}]::<lambda(auto:1 ...)>*)0)->operator()<auto:1
...>(static_cast<auto:1&>(fooV::__lambda2::_FUN::<unnamed>) ...)) = void]'
mziudrma.cpp:8:27:   required from 'int fooV(Ts ...) [with Ts = {const char*,
int, double, char, float, short int, unsigned int}]'
mziudrma.cpp:13:65:   required from here
mziudrma.cpp:2:12: internal compiler error: Segmentation fault
    2 |   auto L = [](auto ... a) {
      |            ^~~~~~~~~~~~~~~~
    3 |     auto M = [](decltype(a) ... b) -> void {
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    4 |     };
      |     ~~      
    5 |     return M;
      |     ~~~~~~~~~
    6 |   };
      |   ~         
0xf780df crash_signal
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/toplev.c:326
0x87eb94 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/tree.h:3289
0x87eb94 build_call_a(tree_node*, int, tree_node**)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/call.c:396
0x9d5142 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:18886
0x9df6af tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:18238
0x9df6af tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:17914
0x9e0ed6 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:17030
0x9df721 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:17321
0x9df096 instantiate_decl(tree_node*, bool, bool)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:24774
0xa0569b instantiate_pending_templates(int)
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/pt.c:24890
0x91e770 c_parse_final_cleanups()
       
/var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190414/work/gcc-9-20190414/gcc/cp/decl2.c:4818

Reply via email to