https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92969
Bug ID: 92969
Summary: Segmentation fault compiling partial specialization of
auto-deduced member function pointers
Product: gcc
Version: 9.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: joe.antoon at gmail dot com
Target Milestone: ---
Created attachment 47511
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47511&action=edit
preprocessed source
The following code, which auto-deduces and partially specializes a parameter
pack of member function pointers, causes a segmentation fault during
compilation:
CODE:
template <auto... Methods>
struct Foo;
template <
typename Class,
typename... ReturnType,
ReturnType (Class::*...Methods)()>
struct Foo<Methods...> {
constexpr void operator ()() { }
};
struct Bar {
int baz() { return 42; }
};
void tryOut() {
Foo<&Bar::baz>{}();
}
EXPECTED RESULT: compiles on clang v9 without errors
ACTUAL RESULT:
during RTL pass: expand
<source>: In function 'void tryOut()':
<source>:17:19: internal compiler error: Segmentation fault
17 | Foo<&Bar::baz>{}();
| ~~~~~~~~~~~~~~~~^~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Encountered on g++-9 Ubuntu 18.04 WSL.
COMMAND: g++ test.cpp -std=c++17
SYSTEM TYPE: x86_64-linux-gnu
VERSION: gcc version 9.2.1 20191102 (Ubuntu 9.2.1-17ubuntu1~18.04.1)
CONFIGURATION: Configured with: ../src/configure -v --with-pkgversion='Ubuntu
9.2.1-17ubuntu1~18.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Also reproduces on Compiler Explorer:
COMMAND: g++ test.cpp -std=c++17
SYSTEM TYPE: x86_64-linux-gnu
VERSION: gcc version 9.2.0 (Compiler-Explorer-Build)
CONFIGURATION: Configured with: ../gcc-9.2.0/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu --enable-languages=c,c++,fortran,ada,d
--enable-ld=yes --enable-gold=yes --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-linker-build-id --enable-lto
--enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build
https://godbolt.org/z/PJZdPL