The [[noreturn]] attribute can be applied to functions that are not meant to return. For example:
[[noreturn]] void will_throw() { throw std::r
Consider what you are actually saying:
class B
{
public:
[[noreturn]] virtual void f() { throw std::runtime_error(""); }
};
Certainly the human reader, and possibly the compiler, would interpret
this as a 'contract', i.e.
"f() wont return, I promise"
That should then apply to overrides of f() too, or else you are breaking the contract.
The standard might be underspecified on this, but even if it works, I would recommend against it based on readability.