(C++) base class 'struct QtPrivate::AlignOf\_WorkaroundForI386Abi<double>' has a non-virtual destructor
February 24, 2017 · View on GitHub
(C++) base class 'struct QtPrivate::AlignOf_WorkaroundForI386Abi<double>' has a non-virtual destructor
Full error message
06:27:48: Running steps for project ToolHometrainerConsole... 06:27:48: Starting: "/usr/bin/qmake" /home/richel/ProjectRichelBilderbeek/Tools/ToolHometrainer/ToolHometrainerConsole.pro -r -spec linux-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug 06:27:50: The process "/usr/bin/qmake" exited normally. 06:27:50: Starting: "/usr/bin/make" g++ -c -pipe -std=c++11 -Wall -Wextra -Weffc++ -Werror -g -Wall -W -D_REENTRANT -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++ -I../ToolHometrainer -I../../Classes/CppAbout -I../../Classes/CppExercise -I../../Classes/CppFileIo -I../../Classes/CppHelp -I../../Classes/CppMenuDialog -I../../Classes/CppMultipleChoiceQuestion -I../../Classes/CppMultipleChoiceQuestionDialog -I../../Classes/CppOpenQuestion -I../../Classes/CppOpenQuestionDialog -I../../Classes/CppQuestion -I../../Classes/CppQtQuestionDialog -I../../Classes/CppRichelBilderbeekProgram -I../../Classes/CppTrace -I../ToolHometrainer -I/usr/include/qt5 -I/usr/include/qt5/QtCore -I. -I. -o qrc_ToolHometrainer.o qrc_ToolHometrainer.cpp In file included from qrc_ToolHometrainer.cpp:9:0: /usr/include/qt5/QtCore/qglobal.h:403:24: error: base class 'struct QtPrivate::AlignOf_WorkaroundForI386Abi<double>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qglobal.h:404:24: error: base class 'struct QtPrivate::AlignOf_WorkaroundForI386Abi<long long int>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qglobal.h:405:24: error: base class 'struct QtPrivate::AlignOf_WorkaroundForI386Abi<long long unsigned int>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qglobal.h: In instantiation of 'struct QIntegerForSizeof<void*>': /usr/include/qt5/QtCore/qglobal.h:435:33: required from here /usr/include/qt5/QtCore/qglobal.h:434:27: error: base class 'struct QIntegerForSize<4>' has a non-virtual destructor [-Werror=effc++] In file included from /usr/include/qt5/QtCore/qflags.h:48:0, from /usr/include/qt5/QtCore/qglobal.h:1094, from qrc_ToolHometrainer.cpp:9: /usr/include/qt5/QtCore/qtypetraits.h:221:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:222:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:223:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:224:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:231:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:233:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:234:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:235:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:236:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:237:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:238:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:243:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:244:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:253:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:254:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h:255:19: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<unsigned char>': /usr/include/qt5/QtCore/qtypetraits.h:481:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<signed char>': /usr/include/qt5/QtCore/qtypetraits.h:482:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<unsigned char> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<unsigned char>' /usr/include/qt5/QtCore/qtypetraits.h:484:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<unsigned char>': /usr/include/qt5/QtCore/qtypetraits.h:484:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<unsigned char> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<signed char> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<signed char>' /usr/include/qt5/QtCore/qtypetraits.h:485:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<signed char>': /usr/include/qt5/QtCore/qtypetraits.h:485:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<signed char> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<short unsigned int>': /usr/include/qt5/QtCore/qtypetraits.h:487:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<short int>': /usr/include/qt5/QtCore/qtypetraits.h:488:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<short unsigned int> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<short unsigned int>' /usr/include/qt5/QtCore/qtypetraits.h:490:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<short unsigned int>': /usr/include/qt5/QtCore/qtypetraits.h:490:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<short unsigned int> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<short int> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<short int>' /usr/include/qt5/QtCore/qtypetraits.h:491:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<short int>': /usr/include/qt5/QtCore/qtypetraits.h:491:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<short int> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<unsigned int>': /usr/include/qt5/QtCore/qtypetraits.h:493:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<int>': /usr/include/qt5/QtCore/qtypetraits.h:494:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<unsigned int> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<unsigned int>' /usr/include/qt5/QtCore/qtypetraits.h:496:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<unsigned int>': /usr/include/qt5/QtCore/qtypetraits.h:496:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<unsigned int> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<int> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<int>' /usr/include/qt5/QtCore/qtypetraits.h:497:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<int>': /usr/include/qt5/QtCore/qtypetraits.h:497:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<int> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<long long unsigned int>': /usr/include/qt5/QtCore/qtypetraits.h:499:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_unsigned<long long int>': /usr/include/qt5/QtCore/qtypetraits.h:500:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:473:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<long long unsigned int> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<long long unsigned int>' /usr/include/qt5/QtCore/qtypetraits.h:502:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, false>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<long long unsigned int>': /usr/include/qt5/QtCore/qtypetraits.h:502:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<long long unsigned int> >' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::not_<QtPrivate::is_unsigned<long long int> >': /usr/include/qt5/QtCore/qtypetraits.h:478:8: required from 'struct QtPrivate::is_signed<long long int>' /usr/include/qt5/QtCore/qtypetraits.h:503:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:463:8: error: base class 'struct QtPrivate::integral_constant<bool, true>' has a non-virtual destructor [-Werror=effc++] /usr/include/qt5/QtCore/qtypetraits.h: In instantiation of 'struct QtPrivate::is_signed<long long int>': /usr/include/qt5/QtCore/qtypetraits.h:503:1: required from here /usr/include/qt5/QtCore/qtypetraits.h:478:8: error: base class 'struct QtPrivate::not_<QtPrivate::is_unsigned<long long int> >' has a non-virtual destructor [-Werror=effc++] cc1plus: all warnings being treated as errors make: *** [qrc_ToolHometrainer.o] Error 1 06:29:17: The process "/usr/bin/make" exited with code 2. Error while building/deploying project ToolHometrainerConsole (kit: Desktop) When executing step 'Make' 06:29:18: Elapsed time: 01:29.
Cause
The following code caused this compile error:
#include <vector> struct MyClass {}; int main() { const int size = 10; //Or other positive int std::vector<MyClass*> v(size,0); }
IDE: C++ Builder 6.0
Compiler: Borland BCC32.EXE version 6.0.10.157
Project type: Console
The zero denotes that the MyClass pointer is uninitialized. The compiler, however, believes this zero denotes an integer value.
The code where the compiler takes you, in _algobase.h:
template <class _OutputIter, class _Size, class _Tp> _STLP_INLINE_LOOP _OutputIter fill_n(_OutputIter __first, _Size __n, const _Tp& __value) { _STLP_FIX_LITERAL_BUG(__first) for ( ; __n > 0; --__n, ++__first) *__first = __value; //THIS LINE return __first; }
Solution
The text of /usr/include/qt5/QtCore/qglobal.h must be changed.
//Add ignore warnings directly in beginning #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Weffc++" //Add ignore warnings directly before end #pragma GCC diagnostic pop
Or use this script:
#!/bin/bash FILE="/usr/include/qt5/QtCore/qglobal.h" #FILE="test.txt" echo "#pragma GCC diagnostic ignored \"-Weffc++\""|cat - $FILE > /tmp/out && mv /tmp/out $FILE echo "#pragma GCC diagnostic push"|cat - $FILE > /tmp/out && mv /tmp/out $FILE echo "#pragma GCC diagnostic pop" >> $FILE