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

            Bug ID: 84036
           Summary: [8 Regression] ICE on valid code in C++14, variadic
                    lambda capture in a template function
           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: ---

Older versions of g++ compile this successfully, g++-8 fails with an ICE:

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

int main(){
    f(0);
}

$ g++ --version
g++ (GCC) 8.0.1 20180124 (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.

$ g++ -std=c++14 main.cpp
main.cpp: In instantiation of 'auto f(T) [with T = int]':
main.cpp:9:8:   required from here
main.cpp:4:9: internal compiler error: in build_capture_proxy, at
cp/lambda.c:446
         [i ...]{};
         ^
0x8a0975 build_capture_proxy(tree_node*, tree_node*)
        ../../gcc/gcc/cp/lambda.c:446
0x8a36d6 start_lambda_function(tree_node*, tree_node*)
        ../../gcc/gcc/cp/lambda.c:1360
0x924750 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:17005
0x926098 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:18299
0x9339f9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:17053
0x9339f9 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16791
0x932530 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16012
0x931351 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15998
0x930b41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16275
0x930b41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16275
0x92479b tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15983
0x92479b tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ../../gcc/gcc/cp/pt.c:17009
0x926098 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:18299
0x9339f9 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        ../../gcc/gcc/cp/pt.c:17053
0x9339f9 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16791
0x932530 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16012
0x931351 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15998
0x930b41 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:16275
0x92fdd8 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        ../../gcc/gcc/cp/pt.c:15983
0x92fdd8 instantiate_decl(tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.c:23337
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.


Known to work with:

$ 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.
$ 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.

Reply via email to