boostorg / system

Boost.org system module
http://boost.org/libs/system
36 stars 85 forks source link

1.79.0: Warnig error_category has accessible non-virtual destructor #83

Closed AndWass closed 2 years ago

AndWass commented 2 years ago

When building with -Wnon-virtual-dtor with gcc, and creating a new error category this error pops up.

Minimal example: https://godbolt.org/z/off6aea3Y

pdimov commented 2 years ago

The warning is triggered by the friend declarations in error_category: https://github.com/boostorg/system/blob/e197c5e80373736cabc319b2d4fa0657e7821e87/include/boost/system/detail/error_category.hpp#L58-L59

This has already been reported as a bug to GCC twice: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68300, https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102168.

Unfortunately, the first one of these has been closed as "wontfix". I added a comment to the second one referencing this issue.

I'm afraid there's nothing we can do on our side to avoid the warning at the moment. You can suppress it locally by using a pragma, as in https://godbolt.org/z/dnnfj419c.

AndWass commented 2 years ago

Thanks for the explanation. I also went with the warning suppression for now.

jwakely commented 2 years ago

It's a dumb warning, don't use it. The -Wdelete-non-virtual-dtor is much more useful, and enabled by -Wall.