Re: Bug in the linker
Andreas Schwab <[email protected]> Wed, 21 Aug 2019 16:09:33 +0200
| Newsgroups | gmane.comp.gnu.utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
On Aug 21 2019, johnny dude <[email protected]> wrote: > root@44027fc60f45:/# cat a.cpp > #include <iostream> > struct A { int n; A(int n) : n(n + 10) {} }; > int a(int n) { return A(n).n; } > extern int b(int n); > int main(int, char**) { std::clog << a(5) << ", " << b(5) << "\n"; } > > root@44027fc60f45:/# cat b.cpp > #include <iostream> > struct A { int n; A(int n) : n(n + 100) {} }; > int b(int n) { return A(n).n; } This violates basic.def.odr. Andreas. -- Andreas Schwab, [email protected] GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."