[Bug c++/82288] New: Defining a type in a parameter type of a lambda calling an undefined function results in a Segfault
jasper at mezzo dot de
gcc-bugzilla@gcc.gnu.org
Thu Sep 21 23:23:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82288
Bug ID: 82288
Summary: Defining a type in a parameter type of a lambda
calling an undefined function results in a Segfault
Product: gcc
Version: 7.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: jasper at mezzo dot de
Target Milestone: ---
This very simple (though incorrect) piece of code produces a segfault:
-----------------------------
int main() {
[](struct {} *arg) { a();};
}
-----------------------------
$ c++ mnwe.cpp
mnwe.cpp: In function ‘int main()’:
mnwe.cpp:2:13: error: types may not be defined in parameter types
[](struct {} *arg) { a();};
^
c++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://bugs.archlinux.org/> for instructions.
The segfault goes away if any one of these are done:
- define a() somewhere
- replace the `struct {}` in the parameter list with `int`
- define a function instead of the lambda
System Information:
System Type: Arch Linux
GCC version: 7.2.0 (package version 7.2.0-3)
Output of c++ -v:
$ c++ -v
Using built-in specs.
COLLECT_GCC=c++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --disable-multilib --disable-werror
--enable-checking=release --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.2.0 (GCC)
More information about the Gcc-bugs
mailing list