3 ms·
Little to do with ODR. The inline function must have the same tokens in every translation unit otherwise it is undefined behaviour.
by varajelle 5y ago
Little to do with ODR.
The inline function must have the same tokens in every translation unit otherwise it is undefined behaviour.
- dataflow 5y agoSame tokens? So you're saying 'inline int foo(void);' + 'typedef int I; inline I foo(void);' is UB?
- MauranKilom 5y agoQuoting the C++ 17 standard draft [0]: > There can be more than one definition in a program of [...an] inline function [...] as long as all of the following is true: > - each definition consists of the same sequence of tokens (typically, appears in the same header file) > [...] > If all these requirements are satisfied, the program behaves as if there is only one definition in the entire program. Otherwise, the program is ill-formed, no diagnostic required. [0]: https://timsong-cpp.github.io/cppwp/n4659/basic.def.odr#6.1 https://timsong-cpp.github.io/cppwp/n4659/basic.def.odr#6.1