There is a sentence in the cppreference.com description of Deleted functions:
However, implicit ODR-use of a non-pure virtual member function that happens to be deleted is allowed.
Could you provide a code example of this case?
I tried to do this:
struct ff
{
virtual int fd()
{
return 0;
}
};
struct ddff : public ff
{
int fd()
{
throw std::exception("ttt");
}
};
struct dd : public ddff
{
int fd() = delete;
};
int main()
{
ff* d = new dd();
d->fd();
But it brings a error:
Error C2282 'dd::fd' cannot override 'ddff::fd'
Thanks for comment:
Virtual functions are considered odr-used even if you never mentioned them in your code. What the sentence is saying is that such an odr-use is fine with deleted functions. Your error comes from the fact that deleted functions can't override non-deleted functions and vice versa.