From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 24BE2385781B; Sat, 27 Mar 2021 21:29:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 24BE2385781B From: "e.fokken+gnu at posteo dot de" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 5.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: e.fokken+gnu at posteo dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Mar 2021 21:29:36 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D71484 Eike changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |e.fokken+gnu at posteo dot= de --- Comment #6 from Eike --- 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 mem= ber. My g++ --version returns: g++ (Debian 10.2.1-6) 10.2.1 20210110 template struct static_arbitrary_seed { private: static constexpr IntType fnv(IntType hash, const char *pos) { return *pos =3D=3D '\0' ? hash : fnv((hash * IntType(16777619U)) ^ *pos, (pos + = 1)); } public: static constexpr IntType value =3D 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 =E2=80=98pcg_extras::static_arbitrary_seed=E2=80=99 are priv= ate [-Wctor-dtor-privacy] The code is from https://github.com/imneme/pcg-cpp in case that is helpful.=