Constexpr and function body = delete: what is the purpose?

advertisements

According to the [dcl.constexpr/3]:

The definition of a constexpr function shall satisfy the following requirements:
[...]
- its function-body shall be = delete, = default, or [...]

This means that the following class snippet is valid:

struct S {
    constexpr void f() = delete;
};

What's the purpose of having a deleted constexpr function?
What are the benefit of defining it constexpr if any?

I can't figure out any reason, but the fact that maybe it's easier to allow it than to forbid it in the standard.


This was based on CWG 1199. Daniel Krügler wrote:

it could be useful to allow this form in a case where a single piece of code is used in multiple configurations, in some of which the function is constexpr and others deleted; having to update all declarations of the function to remove the constexpr specifier is unnecessarily onerous.