From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7C39B3858414; Fri, 4 Nov 2022 21:30:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C39B3858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1667597421; bh=hBpQ5eGJxyGCIxUfTcTORhNye09VU2zNFTCCyd+AXyg=; h=From:To:Subject:Date:From; b=g8O1d83bnQuUrK4LN8JYxjYJcL2KQNjMEmit7CE4VRRVtWJlDMXuq3sGROpT+0ahq +8OHzatyJ2wlfMdIqAZlS+G4WRHU32EkGwwj90/ceo6mVtf4WG+1QGO/4iJRQb3tQH FolM//yutYSuDwh7NafVWL0Ufoe5ktOlW0fgku30= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: =?UTF-8?B?W0J1ZyBjKysvMTA3NTI3XSBOZXc6IHdhcm5pbmc6IGRlY2xhcmF0?= =?UTF-8?B?aW9uIG9mIOKAmHZvaWQgb3BlcmF0b3IgZGVsZXRlKHZvaWQqLCBzdGQ6OnNp?= =?UTF-8?B?emVfdCnigJkgaGFzIGEgZGlmZmVyZW50IGV4Y2VwdGlvbiBzcGVjaWZpZXIg?= =?UTF-8?B?Wy1Xc3lzdGVtLWhlYWRlcnNd?= Date: Fri, 04 Nov 2022 21:30:21 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 12.2.1 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status keywords bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107527 Bug ID: 107527 Summary: warning: declaration of =E2=80=98void operator delete(v= oid*, std::size_t)=E2=80=99 has a different exception specifi= er [-Wsystem-headers] Product: gcc Version: 12.2.1 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- This code compiles cleanly unless you use -Wsystem-headers: #include #include void* operator new(std::size_t n) { return std::malloc(n); } void operator delete(void* p) { std::free(p); } void operator delete(void* p, std::size_t) { std::free(p); } $ g++ del.C -c $ g++ del.C -c -Wsystem-headers del.C:9:6: warning: declaration of =E2=80=98void operator delete(void*)=E2= =80=99 has a different exception specifier [-Wsystem-headers] 9 | void operator delete(void* p) | ^~~~~~~~ In file included from del.C:1: /usr/include/c++/12/new:130:6: note: from previous declaration =E2=80=98voi= d operator delete(void*) noexcept=E2=80=99 130 | void operator delete(void*) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ del.C:14:6: warning: declaration of =E2=80=98void operator delete(void*, st= d::size_t)=E2=80=99 has a different exception specifier [-Wsystem-headers] 14 | void operator delete(void* p, std::size_t) | ^~~~~~~~ /usr/include/c++/12/new:135:6: note: from previous declaration =E2=80=98voi= d operator delete(void*, std::size_t) noexcept=E2=80=99 135 | void operator delete(void*, std::size_t) _GLIBCXX_USE_NOEXCEPT | ^~~~~~~~ But the warning is correct, and indicates a problem in the user code. It sh= ould not be suppressed by the system header.=