https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70486
Bug ID: 70486 Summary: Constexpr array captured in lambda function (used via std::function) Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: krzyk240 at gmail dot com Target Milestone: --- Created attachment 38150 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38150&action=edit The *.i* file //////////////////////////////////////////////////////////////////// #include <iostream> #include <functional> int main() { constexpr int t[2] = { 1, 2 }; std::function<void()> foo = [&] { for (int i = 0; i < 2; ++i) std::cout << t[i] << ' '; }; foo(); return 0; } //////////////////////////////////////////////////////////////////// $ g++-5.1 -std=c++11 -Wall -Wextra main.cpp -v -save-temps Using built-in specs. COLLECT_GCC=g++-5.1 COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-5.1.0/configure --prefix=/usr/local --disable-multilib --without-mpc --without-mpfr --without-gmp --without-cloog --without-isl --enable-languages=c,c++ Thread model: posix gcc version 5.1.0 (GCC) COLLECT_GCC_OPTIONS='-std=c++11' '-Wall' '-Wextra' '-v' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/cc1plus -E -quiet -v -imultiarch x86_64-linux-gnu -D_GNU_SOURCE main.cpp -mtune=generic -march=x86-64 -std=c++11 -Wall -Wextra -fpch-preprocess -o main.ii ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu" ignoring nonexistent directory "/usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../x86_64-unknown-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0 /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/x86_64-unknown-linux-gnu /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/../../../../include/c++/5.1.0/backward /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include /usr/local/include /usr/local/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/include-fixed /usr/include/x86_64-linux-gnu /usr/include End of search list. COLLECT_GCC_OPTIONS='-std=c++11' '-Wall' '-Wextra' '-v' '-save-temps' '-shared-libgcc' '-mtune=generic' '-march=x86-64' /usr/local/libexec/gcc/x86_64-unknown-linux-gnu/5.1.0/cc1plus -fpreprocessed main.ii -quiet -dumpbase main.cpp -mtune=generic -march=x86-64 -auxbase main -Wall -Wextra -std=c++11 -version -o main.s GNU C++11 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 5.1.0, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 GNU C++11 (GCC) version 5.1.0 (x86_64-unknown-linux-gnu) compiled by GNU C version 5.1.0, GMP version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9 GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 03db94ff6398330bffd2a80db4ec6941 main.cpp: In lambda function: main.cpp:8:20: internal compiler error: in make_decl_rtl, at varasm.c:1313 std::cout << t[i] << ' '; ^ libbacktrace could not find executable to open Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. //////////////////////////////////////////////////////////////////// $ uname -a Linux stacked-crooked 3.2.0-74-virtual #109-Ubuntu SMP Tue Dec 9 17:04:48 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux