This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/88136, -Wdeprecated-copy too noisy


On Thu, 6 Dec 2018 at 23:12, Jason Merrill <jason@redhat.com> wrote:
>
> -Wdeprecated-copy does find some real bugs, but it also complains
> about a lot of reasonable code for which the implicitly declared copy
> ctor/op= are fine oven though the class has a user-defined destructor:
> this situation is only problematic if the destructor releases
> resources held in one of the non-static data members.
>
> So, this patch reins it in somewhat: first by moving from -Wall to
> -Wextra, and then also only complaining if the other copy op is
> user-declared.  The old behavior can be explicitly requested with
> -Wdeprecated-copy-dtor.

Hmm.

g++ -c -pipe -O2 -fPIC -std=c++1z -fvisibility=hidden
-fvisibility-inlines-hidden -ffunction-sections -fdata-sections
-fno-exceptions -Wall -W -Wvla -Wdate-time -Wshift-overflow=2
-Wduplicated-cond -Wno-stringop-overflow -Werror -Wno-error=cpp
-Wno-error=deprecated-declarations -Wno-error=strict-overflow
-Wno-error=implicit-fallthrough -D_REENTRANT
-DQT_VERSION_STR='"5.12.0"' -DQT_VERSION_MAJOR=5 -DQT_VERSION_MINOR=12
-DQT_VERSION_PATCH=0 -DQT_BOOTSTRAPPED -DQT_NO_CAST_TO_ASCII
-DQT_NO_FOREACH -DQT_NO_CAST_FROM_ASCII
-DQT_NO_NARROWING_CONVERSIONS_IN_CONNECT -DQT_BUILD_BOOTSTRAP_LIB
-DQT_BUILDING_QT -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT
-DQT_USE_QSTRINGBUILDER -DQT_DEPRECATED_WARNINGS
-DQT_DISABLE_DEPRECATED_BEFORE=0x050000 -DQT_NO_EXCEPTIONS
-D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_NO_DEBUG
-I/home/vivoutil/kuutti/qt5-5.12/qtbase/src/tools/bootstrap -I.
-I../../../include -I../../../include/QtCore
-I../../../include/QtCore/5.12.0
-I../../../include/QtCore/5.12.0/QtCore -I../../../include/QtXml
-I../../../include/QtXml/5.12.0 -I../../../include/QtXml/5.12.0/QtXml
-I/home/vivoutil/kuutti/qt5-5.12/qtbase/mkspecs/linux-g++ -o
.obj/qglobal.o /home/vivoutil/kuutti/qt5-5.12/qtbase/src/corelib/global/qglobal.cpp
In file included from ../../../include/QtCore/qvariant.h:1,
                 from
../../../include/QtCore/5.12.0/QtCore/private/../../../../../../../qtbase/src/corelib/tools/qlocale_p.h:58,
                 from
../../../include/QtCore/5.12.0/QtCore/private/../../../../../../../qtbase/src/corelib/tools/qlocale_tools_p.h:54,
                 from
../../../include/QtCore/5.12.0/QtCore/private/qlocale_tools_p.h:1,
                 from
/home/vivoutil/kuutti/qt5-5.12/qtbase/src/corelib/global/qglobal.cpp:52:
../../../include/QtCore/../../../../qtbase/src/corelib/kernel/qvariant.h:
In constructor ‘QVariant::QVariant(QVariant&&)’:
../../../include/QtCore/../../../../qtbase/src/corelib/kernel/qvariant.h:273:25:
error: implicitly-declared ‘constexpr QVariant::Private&
QVariant::Private::operator=(const QVariant::Private&)’ is deprecated
[-Werror=deprecated-copy]
  273 |     { other.d = Private(); }
      |                         ^
../../../include/QtCore/../../../../qtbase/src/corelib/kernel/qvariant.h:399:16:
note: because ‘QVariant::Private’ has user-provided
‘QVariant::Private::Private(const QVariant::Private&)’
  399 |         inline Private(const Private &other) Q_DECL_NOTHROW
      |                ^~~~~~~
cc1plus: all warnings being treated as errors

That doesn't have -Wextra. Yet the -Wdeprecated-copy still triggers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]