20-12-2024, 02:15 PM
The rule requires that ODR isn't violated, as defined by the standard. In general, its impractical for us explicitly enumerate all the way ODR can be violated.
In general, you need to consult [basic.def.odr]. However, our reading of the standard is that the answer to your first question is No (your example does not violate ODR)
Other refs:
https://en.cppreference.com/w/cpp/language/definition
https://eel.is/c++draft/basic.link#:linkage,inline_and
We also agree that the answer to your second question is Yes
In general, you need to consult [basic.def.odr]. However, our reading of the standard is that the answer to your first question is No (your example does not violate ODR)
Other refs:
https://en.cppreference.com/w/cpp/language/definition
https://eel.is/c++draft/basic.link#:linkage,inline_and
We also agree that the answer to your second question is Yes
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group