public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110851] New: [contracts] Inheriting multiple base functions with clashing contracts is not diagnosed
@ 2023-07-30 9:00 ville.voutilainen at gmail dot com
0 siblings, 0 replies; only message in thread
From: ville.voutilainen at gmail dot com @ 2023-07-30 9:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110851
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 <= 0 ]] {}
};
struct Derived : public Base1, public Base2 {
virtual void g(int x) override {}
};
int main()
{
Derived d1;
Base1& b1 = d1;
Base2& b2 = 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.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-07-30 9:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-30 9:00 [Bug c++/110851] New: [contracts] Inheriting multiple base functions with clashing contracts is not diagnosed ville.voutilainen at gmail dot com
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).