Hacker News new | past | comments | ask | show | jobs | submit login

Same tokens? So you're saying 'inline int foo(void);' + 'typedef int I; inline I foo(void);' is UB?



Quoting 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: