arvidn / libtorrent

an efficient feature complete C++ bittorrent implementation
http://libtorrent.org
Other
5.27k stars 997 forks source link

Warnings emitted by -Wdeprecated-redundant-constexpr-static-def #7794

Open giesmininkas opened 1 week ago

giesmininkas commented 1 week ago

Please provide the following information

libtorrent version (or branch): 2.0.10 platform/architecture: x86_64 GNU/Linux compiler and compiler version: clang-19 w/ libc++-19

Clang check -Wdeprecated-redundant-constexpr-static-def, when compiling in C++17 or greater, emits many warnings, such as:

libtorrent-src/src/alert.cpp:72:36: warning: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Wdeprecated-redundant-constexpr-static-def]
   72 |         constexpr alert_category_t alert::error_notification;
      |                                           ^

The warnings could be easily silenced by checking the __cplusplus preprocessor macro:

#if __cplusplus < 201703L
// define constexpr static data members
#endif

I can submit a patch if needed.

Thank you!