This is the mail archive of the gcc-bugs@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]

[Bug c++/81250] C++ warnings about unused stl


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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
The technical reason for that is that according to the language neither all
constructors nor the destructor of std::string are trivial special members. I
think the request as indicated by the title ("unused STL") should be withdrawn,
since there are obvious type (combinations) of the Standard Library that really
should be considered as used just if they are constructed or destructed, such
as std::tuple<SideEffects> when SideEffects is a user-defined type whose
construction or destruction has side effects. Another example where a seemingly
"unused" object could exist for some purpose are smart pointers like
shared_ptr, weak_ptr, or unique_ptr, which might be constructed simplify to
define a scope where a contained object exists. Another candidate of an
"unused" object where you really don't want be nagged about is any of the lock
templates, and there are presumably a lot others. When considering to enable
such a warning for selected types, the hard question is: Where do we stop? Is
that a request that will never end? Today std::string, tomorrow ??

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