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

            Bug ID: 84181
           Summary: [8 Regression] ICE in variadic lambda inside a
                    template when constructing a decltype type
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: benni.buch at gmail dot com
  Target Milestone: ---

This is a very serious regression because it affects Boost.Hana directly.


template < int ... I >
struct A{};

template < typename T >
void f(){
    [](auto ... i){
        return A< decltype(i){} ... >{};
    };
}

int main(){
    f< int >();
}


$ g++ -std=c++14 main.cpp 
main.cpp: In instantiation of 'void f() [with T = int]':
main.cpp:12:14:   required from here
main.cpp:7:39: internal compiler error: in strip_typedefs_expr, at
cp/tree.c:1690
         return A< decltype(i){} ... >{};
                                       ^
0x63696d strip_typedefs_expr(tree_node*, bool*)
        ../../gcc/gcc/cp/tree.c:1690
0x997709 strip_typedefs_expr(tree_node*, bool*)
        ../../gcc/gcc/cp/tree.c:1795
0x90f33c canonicalize_expr_argument
        ../../gcc/gcc/cp/pt.c:7489
0x9477db canonicalize_expr_argument
        ../../gcc/gcc/cp/pt.c:7486
0x9477db convert_template_argument
        ../../gcc/gcc/cp/pt.c:7823
0x945ada coerce_template_parameter_pack
        ../../gcc/gcc/cp/pt.c:7971
0x945ada coerce_template_parms
        ../../gcc/gcc/cp/pt.c:8191
0x93f2b6 lookup_template_class_1
        ../../gcc/gcc/cp/pt.c:8818
0x93f2b6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ../../gcc/gcc/cp/pt.c:9167
0x940d5a tsubst_aggr_type
        ../../gcc/gcc/cp/pt.c:12073
0x93b27e tsubst(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:13706
0x926e14 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:18153
0x934e49 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:17100
0x934e49 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16838
0x932ea0 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16055
0x931f61 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16322
0x931f61 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16322
0x925b9b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16030
0x925b9b tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:17056
0x927498 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:18346
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ g++ --version
g++ (GCC) 8.0.1 20180202 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Known to work with GCC 6.3 and 5.4:

$ g++-6 --version
g++-6 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04) 6.3.0 20170519
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ g++-5 --version
g++-5 (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Reply via email to