[Bug c++/70018] Possible issue around IPO and C++ inline functions
sanjoy at playingwithpointers dot com
gcc-bugzilla@gcc.gnu.org
Mon Feb 29 19:46:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70018
--- Comment #3 from Sanjoy Das <sanjoy at playingwithpointers dot com> ---
(In reply to Andrew Pinski from comment #1)
> In C++ code, the one definition rule says that all TU that contains an
> inline function, they need to have the same definition. If they have
> different definition, then the code is undefined at runtime and no
> diagnostic is required.
Hi Andrew,
I believe that is an incorrect assessment of the test case:
https://github.com/sanjoy/comdat-ipo
At the C++ source level there is only one definition of maybe_divide
that is in header.hpp included by both source-a.cpp and source-b.cpp.
If this violates ODR then every C++ program with inline functions in
the header violates ODR. :)
More information about the Gcc-bugs
mailing list