I just want the compuler knows that my class has some public methods before I define whole class structure. The same is right for deduced this as well. The method of partial declaration I proposed uses extern keyword without variable declaration. If you think this method leads to misuse and errors, I can propose an alternative:

struct worker;
void worker::work();

On Tue, Aug 24, 2021, 00:09 Thiago Macieira via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
On Sunday, 22 August 2021 05:27:12 PDT Valery Osheter via Std-Proposals wrote:
> The compiler allows the forward declaration of a type name only. The type
> name then can be used as a reference or a pointer only. If we want to call
> a method of this type, a complete type definition is required. I understand
> that this requirement comes from the storage details. But this compiler's
> restriction is unnecessery for static and non-virtual methods, and other
> things that are not related to the instance data.

Before we go further, please make sure that your request takes
https://wg21.link/p0847 into consideration: in a C++ world with deduced this,
do we need extern struct?

Also, mind you,

extern struct worker
{
  void work();
};

and

extern struct worker
{
  void work();
} s;

Have VERY different meanings.

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DPG Cloud Engineering



--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals