public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "e.fokken+gnu at posteo dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/71484] Class with implicit public constructor triggers `-Wctor-dtor-privacy` Date: Sat, 27 Mar 2021 21:29:35 +0000 [thread overview] Message-ID: <bug-71484-4-dYwpr6oVyB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-71484-4@http.gcc.gnu.org/bugzilla/> 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.
prev parent reply other threads:[~2021-03-27 21:29 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-71484-4@http.gcc.gnu.org/bugzilla/> 2019-08-15 15:35 ` redi at gcc dot gnu.org 2021-03-27 21:29 ` e.fokken+gnu at posteo dot de [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-71484-4-dYwpr6oVyB@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).