The following program: ------ #include <functional> struct Foo { std::function <void(double &)> f; Foo ( std::function <void(double &)> const & f_ ) : f(f_) {} }; struct Bar { Foo foo; Bar() : foo([](auto & num) {}) {} }; int main() { Bar bar; } ------ segfaults gdb on startup: $ gdb test19 GNU gdb (Gentoo 7.7.1 p1) 7.7.1 Copyright (C) 2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://bugs.gentoo.org/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from test19...Segmentation fault However, when changing the line foo([](auto & num) {}) to foo([](double & num) {}) gdb works as normal. In case it helps: GNU gdb (Gentoo 7.7.1 p1) 7.7.1 gcc version 4.9.2 (Gentoo 4.9.2 p1.0, pie-0.6.1)
I've verified that this is another libiberty demangler crashing bug. It is also fixed in GDB 7.8+. If you'd like a patch, look at commits 91662bad2, fd259167d, 9548bbede, and 53f94b92e (all in libiberty). It might be possible to toss together something relatively easily by simply grabbing a recent copy of libiberty/cp-demangle.[ch]. Otherwise, the easiest thing to do is simply upgrade to 7.8 or 7.9.