boostorg / lexical_cast

General literal text conversions, such as an int represented as a string, or vice versa
https://boost.org/libs/lexical_cast
34 stars 58 forks source link

calling virtual function in constructor of `boost::detail::basic_pointerbuf` #23

Closed akrzemi1 closed 6 years ago

akrzemi1 commented 6 years ago

clang-tidy reports (while checking the code that uses boost::lexical_cast) a virtual function is called in the default constructor of class template boost::detail::basic_pointerbuf. (Function setbuf() is declared virtual in base class.) This might be an indication of a bug. If not, I would recommend using a different construct that avoids confusion, for instance declaring the function override final in newer versions of C++, or providing another function with different name but with the same semantics as the overriding setbuf().

Here's the link to the offending call: https://github.com/boostorg/lexical_cast/blob/develop/include/boost/detail/basic_pointerbuf.hpp#L42

apolukhin commented 6 years ago

Fixed in https://github.com/boostorg/lexical_cast/commit/fb017f8b82617069fbd57ac248cde7590373b414 by directly specifying the call to this_type.