Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Classes derived from detail::buffer<T> declare non-virtual destructors #1936

Closed
BartSiwek opened this issue Oct 15, 2020 · 4 comments
Closed

Comments

@BartSiwek
Copy link
Contributor

Compiling with gcc (GCC) 10.2.1 and -Werror=non-virtual-dtor:

error: ‘class fmt::v7::detail::counting_buffer<>’ has virtual functions and accessible non-virtual destructor [-Werror=non-virtual-dtor]
...
error: ‘class fmt::v7::basic_memory_buffer<wchar_t>’ has virtual functions and accessible non-virtual destructor [-Werror=non-virtual-dtor]
@mwinterb
Copy link
Contributor

See this comment: #1934 (comment)
But, it looks like making counting_buffer, basic_memory_buffer, etc. final addresses the warning in a proper way, if that's appropriate for those types: https://gcc.godbolt.org/z/7sb694.

@BartSiwek
Copy link
Contributor Author

Thanks for the answer. While I understand that a decision has been made it makes using fmt in codebases who have that warning on (an warnings as errors) very difficult.
I can make a PR that adds the final keyword if that is the desired direction.

@BartSiwek
Copy link
Contributor Author

And here is the PR #1937

@madscientist
Copy link

To me, this change is a mistake. There's nothing wrong with not having a virtual destructor here and I think it's incorrect that the compiler warns about it like this.

Meanwhile not being able to subclass these is a real loss in functionality IMO.

Anyway, my $0.02. Cheers!

vuvova added a commit to MariaDB/server that referenced this issue Oct 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants