top | item 41169864

(no title)

terrymah | 1 year ago

No, calling throw in a noexcept function is a defined behavior (call std::terminate), and that behavior is not a diagnostic

I think maybe WG21 was concerned a compiler engineer would be clever if throwing in noexcept were UB, for example and assume any block that throws is unreachable and could just be removed along with all blocks it postdominates. Compiler guys love optimizations that just remove code. The fastest and smallest code is code that can’t run and doesn’t exist

discuss

order

account42|1 year ago

Compilers are allowed to and do diagnose defined but undesirable behavior though, even more so if that's only enabled with an option.

terrymah|1 year ago

Until yesterday I thought I was the only person in the world who thought the designed behavior was undesirable, though