In the following example function f() returning incomplete type A is marked as deleted:
struct A;
A f() = delete;
It is accepted by GCC, but not in Clang, which complains:
error: incomplete result type 'A' in function definition
Demo: https://gcc.godbolt.org/z/937PEz1h3
Which compiler is right here according to the standard?
Clang is wrong.
That's pretty clear I think. A deleted definition allows for an incomplete class type. It's not like the function can actually be called in a well-formed program, or the body is actually using the incomplete type in some way. The function is a placeholder to signify an invalid result to overload resolution.
Granted, the parameter types are more interesting in the case of actual overload resolution (and the return type can be anything), but there is no reason to restrict the return type into being complete here either.