Issue 121004
Summary -Wglobal-constructors is silenced for derived classes with a virtual base destructor in c++2b mode
Labels new issue
Assignees
Reporter apache-hb
    When a class that contains a non trivial member inherits from a pure virtual base class that has an explicitly declared virtual destructor in c++2b mode -Wglobal-constructors is not raised, but an entry is still added to the .init_array to initialize the objects vtable before main. This behaviour is not present in c++20 mode. The entry is only added at -O0, at -O2 and higher `__cxx_global_var_init` is elided and the vtable is placed directly in the data section which makes this very hard to track down.

Godbolt reproducer link: https://godbolt.org/z/W355314dK
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to