c c++ c++11 language-lawyer noexcept

Does the C++ standard mandate that C-linkage functions are `noexcept`?

I can’t find anything in the standard that forces functions declared with extern "C" to be noexcept, either implicitly or explicitly.

Yet, it should be clear that C calling conventions cannot support exceptions… or is it?

Does the standard mention this, somewhere that I’ve missed? If not, why not? Is it simply left as an implementation detail of sorts?

As far as I can tell there is no guarantee that function defined with “C” linkage will not throw exceptions. The standard allows a C++ program both to call an external function with “C” language linkage, and to define functions written in C++ that have “C” language linkage. Therefore there is nothing to prevent a C++ program from calling a function with “C” language linkage that is actually written in C++ (in another compilation unit maybe, although even this is not necessary). It would be a strange thing to do, but it is hard to rule out. Also I don’t see where in the standard it says that doing so would lead to undefined behaviour (in fact since the Standard cannot define the behaviour of function not written in C++, this would be the only usage where there is not formally undefined behaviour).

As a consequence I think it would be an error to assume that “C” linkage implies noexcept.