https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84044
Arnaud Giersch <arnaud.giersch at free dot fr> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |arnaud.giersch at free dot fr --- Comment #9 from Arnaud Giersch <arnaud.giersch at free dot fr> --- Hi, A similar warning appeared recently with a gcc9 snapshot with a slightly modified code. The main difference seems to be the enum declaration. By "recently", I mean late october or early november (2018). a.cpp ===== struct B { enum class E { V0, V1 }; virtual ~B(); E e; }; B b; int main() {} b.cpp ===== struct B { enum class E { V0, V1 }; virtual ~B(); E e; }; B::~B() = default; ===== $ g++ -O2 -flto a.cpp b.cpp a.cpp:2:14: warning: type 'E' violates the C++ One Definition Rule [-Wodr] 2 | enum class E { V0, V1 }; | ^ a.cpp:2:14: note: an enum with different values is defined in another translation unit a.cpp:4:11: warning: '__dt_del ' violates the C++ One Definition Rule [-Wodr] 4 | virtual ~B(); | ^ b.cpp:1:8: note: '__dt_del ' was previously declared here 1 | struct B { | ^ a.cpp:4:11: warning: '__dt_comp ' violates the C++ One Definition Rule [-Wodr] 4 | virtual ~B(); | ^ b.cpp:1:8: note: '__dt_comp ' was previously declared here 1 | struct B { | ^ $ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc-snapshot/libexec/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 20181110-2' --with-bugurl=file:///usr/share/doc/gcc-snapshot/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr/lib/gcc-snapshot --with-gcc-major-version-only --program-prefix= --enable-shared --enable-linker-build-id --disable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --with-system-zlib --with-target-system-zlib --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 --enable-checking=yes --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.0.0 20181110 (experimental) [trunk revision 266003] (Debian 20181110-2) Regards, Arnaud Giersch