This is a two part question, the first regarding something written entirely in C++, the second part regarding the interaction between functions written in C but called from C++.
Part 1
Is it an ODR or other violation to have different translation units see different noexcept
specifiers on the declaration for the same function? Specifically, if one unit sees:
void foo();
while another one sees:
void foo() noexcept;
Is it an ODR or other violation? You may assume that the function in reality never throws (i.e., it actually could be declared noexcept
).
Part 2
Is it a violation if all C++ code sees the declaration as extern "C" void foo() noexcept;
, but the function is actually defined (implemented) in C where the declaration (obviously) does not include the noexcept
?