As this [answer](https://stackoverflow.com/a/553869/3222702) suggests, I know that it's allowed to use incomplete types as a return value in function's declaration. So I wrote the following code:

**Obj.h**

```
class Obj {
    int x;
};

```

**f.h**

```
class Obj;
Obj f();

```

**f.cpp**

```
#include "Obj.h"

Obj f() {
    return Obj();
}

```

**main.cpp**

```
#include "f.h"
int main() {
    f();
    return 0;
};

```

Compiling this code with the following compiler:

`g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)` 

using the following compilation command:

```
g++ *.cpp

```

gives the following error:

```
main.cpp: In function 'int main()':
main.cpp:4:7: error: invalid use of incomplete type 'class Obj'
     f();
       ^
f.h:1:7: error: forward declaration of 'class Obj'
 class Obj;
       ^

```

So the compiler is not allowing using incomplete type as a return value in a function's declaration. What's the explanation?