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

            Bug ID: 117114
           Summary: [15 Regression] -Woverloaded-virtual false positives
                    on multiple inheritance
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
  Target Milestone: ---

Noticed the warnings and -Werror build failures on today's gcc-master from
r15-4297-gc38385ddbcce9f.

Self-contained example extracted from fheroes2:

// $ cat bug.cc
struct Troops { virtual ~Troops(); };
struct Control { virtual int GetControl() const = 0; };
struct Army : Troops, Control { int GetControl() const override; };

$ g++ -c bug.cc -Woverloaded-virtual
bug.cc:2:30: warning: 'virtual int Control::GetControl() const' was hidden
[-Woverloaded-virtual=]
    2 | struct Control { virtual int GetControl() const = 0; };
      |                              ^~~~~~~~~~
bug.cc:3:37: note:   by 'virtual int Army::GetControl() const'
    3 | struct Army : Troops, Control { int GetControl() const override; };
      |                                     ^~~~~~~~~~

$ g++ -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-15.0.0/bin/g++
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-15.0.0/libexec/gcc/x86_64-unknown-linux-gnu/15.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../source/configure --prefix=/<<NIX>>/gcc-15.0.0
--with-gmp-include=/<<NIX>>/gmp-6.3.0-dev/include
--with-gmp-lib=/<<NIX>>/gmp-6.3.0/lib
--with-mpfr-include=/<<NIX>>/mpfr-4.2.1-dev/include
--with-mpfr-lib=/<<NIX>>/mpfr-4.2.1/lib --with-mpc=/<<NIX>>/libmpc-1.3.1
--with-native-system-header-dir=/<<NIX>>/glibc-2.40-36-dev/include
--with-build-sysroot=/
--with-gxx-include-dir=/<<NIX>>/gcc-15.0.0/include/c++/15.0.0/
--program-prefix= --enable-lto --disable-libstdcxx-pch
--without-included-gettext --with-system-zlib --enable-checking=release
--enable-static --enable-languages=c,c++ --disable-multilib --enable-plugin
--disable-libcc1 --with-isl=/<<NIX>>/isl-0.20 --disable-bootstrap
--build=x86_64-unknown-linux-gnu --host=x86_64-unknown-linux-gnu
--target=x86_64-unknown-linux-gnu
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 15.0.0 99999999 (experimental) (GCC)

Reply via email to