From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id A3D093858C41; Sun, 30 Jul 2023 09:00:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A3D093858C41 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1690707631; bh=xXp+RZLdw/4P7/KEj0HVA9o+DC/5a0c9+3u49YyZ+rk=; h=From:To:Subject:Date:From; b=J+mETglzOl/BIgw90w0LvW+/kcgls/IPEfHkB9aeparFLxJAGy/Mr8sWRWOYFXVUE 7vVFw3MgNghCPGFkPL3kjYH/rsGnZO35dtWKeBkDvkP8ehc9RXgc3buYwrf49ABl/O ce6E1sK1AaJnr2v98K9gVU47GRhd/ILDEe+MDa9w= From: "ville.voutilainen at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/110851] New: [contracts] Inheriting multiple base functions with clashing contracts is not diagnosed Date: Sun, 30 Jul 2023 09:00:28 +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: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ville.voutilainen at gmail dot com 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 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=3D110851 Bug ID: 110851 Summary: [contracts] Inheriting multiple base functions with clashing contracts is not diagnosed Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ville.voutilainen at gmail dot com Target Milestone: --- See https://wandbox.org/permlink/SICxkVAe2gVql3Ae tl;dr: struct Base1 { virtual void g(int x) [[ pre : x > 0 ]] {} }; struct Base2 { virtual void g(int x) [[ pre : x <=3D 0 ]] {} }; struct Derived : public Base1, public Base2 { virtual void g(int x) override {} }; int main() { Derived d1; Base1& b1 =3D d1; Base2& b2 =3D d1; b1.g(42); //b2.g(-42); } The various online compilers accept and run the code. On my machine, I get = an assembler diagnostic: /tmp/ccYlVuY9.s: Assembler messages: /tmp/ccYlVuY9.s:53: Error: symbol `_ZN7Derived1gEi' is already defined which is saying that Derived::g(int) is already defined. The declaration of Derived::g() ought to be ill-formed, because the base functions do not have the same list of contracts.=