https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71484
Eike <e.fokken+gnu at posteo dot de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |e.fokken+gnu at posteo dot de --- Comment #6 from Eike <e.fokken+gnu at posteo dot de> --- The following code also triggers the warning, although it shouldn't in my opinion. Here the private static function is used for initializing a public data member. My g++ --version returns: g++ (Debian 10.2.1-6) 10.2.1 20210110 template <typename IntType> struct static_arbitrary_seed { private: static constexpr IntType fnv(IntType hash, const char *pos) { return *pos == '\0' ? hash : fnv((hash * IntType(16777619U)) ^ *pos, (pos + 1)); } public: static constexpr IntType value = fnv( IntType(2166136261U ^ sizeof(IntType)), __DATE__ __TIME__ __FILE__); }; The warning is: ../pcg-cpp/include/pcg_extras.hpp:578:38: warning: all member functions in class ‘pcg_extras::static_arbitrary_seed<IntType>’ are private [-Wctor-dtor-privacy] The code is from https://github.com/imneme/pcg-cpp in case that is helpful.