[Bug c++/93905] Cannot use Derived type of Base containing both enum and protected destructor

karol.koczwara at ig dot com gcc-bugzilla@gcc.gnu.org
Mon Feb 24 17:26:00 GMT 2020


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

--- Comment #4 from Karol Koczwara <karol.koczwara at ig dot com> ---
gcc -version

COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-8/root/usr/libexec/gcc/x86_64-redhat-linux/8/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-8/root/usr
--mandir=/opt/rh/devtoolset-8/root/usr/share/man
--infodir=/opt/rh/devtoolset-8/root/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu
--with-default-libstdcxx-abi=gcc4-compatible --enable-plugin
--enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-8.3.1-20190311/obj-x86_64-redhat-linux/isl-install
--disable-libmpx --enable-gnu-indirect-function --with-tune=generic
--with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 8.3.1 20190311 (Red Hat 8.3.1-3) (GCC)

The complete command line that triggers the bug:
g++ -std=c++17 file.cpp

Compiler output:

main.cpp: In function ‘int main()’:
main.cpp:15:15: error: ‘BaseSnapshot::~BaseSnapshot()’ is protected within this
context
     Derived d{};
               ^
main.cpp:8:5: note: declared protected here
     ~BaseSnapshot() = default;
     ^


More information about the Gcc-bugs mailing list