> Hello,
> Is there a way to decorate a member function as non overriden, so at the call site the user will receive a compile time warning that he is using the base class implementation instead of the derived class implementation?

If your intent is to force derived classes to override a method, and
you want to give a compile error when attempting to call this function
if the derived class did not, we already have a mechanism for that:
pure virtual functions.
No, actually the contrary. 


If that won't solve the issue, you should explain what functionality
pure virtual functions lack that you're looking for.

Expl:
struct base
{
    virtual void foo(){};
};
struct derived: public base
{
}
int main()
{
   derived d;
   d.foo(); // i would like to receive a warning here telling me that I'm using the base class implementation 
}

Sent from my Galaxy


-------- Original message --------
From: Jason McKesson via Std-Proposals <std-proposals@lists.isocpp.org>
Date: 3/19/22 5:41 PM (GMT+04:00)
To: std-proposals@lists.isocpp.org
Cc: Jason McKesson <jmckesson@gmail.com>
Subject: Re: [std-proposals] Detect non overriden function

On Sat, Mar 19, 2022 at 7:35 AM organicoman via Std-Proposals
<std-proposals@lists.isocpp.org> wrote:
>
> Hello,
> Is there a way to decorate a member function as non overriden, so at the call site the user will receive a compile time warning that he is using the base class implementation instead of the derived class implementation?

If your intent is to force derived classes to override a method, and
you want to give a compile error when attempting to call this function
if the derived class did not, we already have a mechanism for that:
pure virtual functions.

If that won't solve the issue, you should explain what functionality
pure virtual functions lack that you're looking for.
--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals