Suppose a C++ compiler is compiling a function whose definition is available in the same translation unit as its invocation. Suppose that it does not throw itself nor calls a function that is know to throw. Suppose also no extern C code is called, nor a numeric division with a potentially-zero value.
Under these assumptions, will the compiler treat the function as noexcept? If not, are there additional conditions under which noexcept is inferred?
Specifically, what about super-simple functions such as
void foo() { } /* this one */
class A {
int x_;
public:
x() const { return x_; } /* ... and this one */
}
?
I'd like an answer based only on the standard, foremost, and possibly also what GCC and clang do.