[dcl.fct.def] p2 states:
The type of a parameter or the return type for a function definition shall not be an incomplete or abstract (possibly cv-qualified) class type in the context of the function definition unless the function is deleted.
And [class.mem] p7 states:
A class is considered a completely-defined object type (or complete type) at the closing
}
of the class-specifier. The class is regarded as complete within its complete-class contexts; otherwise it is regarded as incomplete within its own class member-specification.
Given this code:
struct S
{
// S is incomplete
S f() { /* S is complete in a function body */ return S(); }
// S is incomplete
};
// S is complete
A complete-class context notably does not include the decl-specifier-seq of the function definition, nor does it include the declarator of the function, however, every compiler says this is ok. What wording allows this, as I cannot find it?