odygrd / quill

Asynchronous Low Latency C++ Logging Library
MIT License
1.36k stars 142 forks source link

CustomTags has a virtual destructor #402

Closed mvanslobbe closed 5 months ago

mvanslobbe commented 6 months ago

When compiling with '-Wnon-virtual-dtor' the current code will lead to

Common.h:214:7: warning: 'quill::CustomTags' has virtual functions but non-virtual destructor [-Wnon-virtual-dtor] class CustomTags

This fixes that.

odygrd commented 5 months ago

Hey, thanks for the PR. How are you using custom_tags ?

It has to be used as in this example https://github.com/odygrd/quill/blob/master/examples/example_custom_tags.cpp#L39

If you add the virtual destructor then it doesn't compile anymore.

e.g.

example_custom_tags.cpp:39:32: error: the type ‘const MyCustomTagsA’ of ‘constexpr’ variable ‘custom_tags_a’ is not literal
   39 | static constexpr MyCustomTagsA custom_tags_a{"CUSTOM_TAG_A", 12};

It seems that instead of adding a virtual dtor, we need to ignore this warning for this class

odygrd commented 5 months ago

moving this to https://github.com/odygrd/quill/pull/405