Re: [Boost-bugs] [Boost C++ Libraries] #4200: Virtual functions, non-virtual destructor

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #4200: Virtual functions, non-virtual destructor
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-03-09 00:35:48


#4200: Virtual functions, non-virtual destructor
--------------------------------+-------------------------------------------
  Reporter: klimkin@… | Owner: emildotchevski
      Type: Bugs | Status: reopened
 Milestone: To Be Determined | Component: exception
   Version: Boost 1.48.0 | Severity: Problem
Resolution: | Keywords:
--------------------------------+-------------------------------------------

Comment (by shartwell@…):

 Here's a test case for gcc. Also applies to all versions of clang.
 {{{
 $ cat nonvdtor.cpp
 #include <string>
 class
 error_info_base
    {
    public:
    virtual std::string tag_typeid_name() const = 0;
    virtual std::string value_as_string() const = 0;
    protected:
    ~error_info_base() throw()
        {
        }
    };
 $ gcc -v -c -Wnon-virtual-dtor nonvdtor.cpp
 ...
 gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.9.00)
 ...
 nonvdtor.cpp:5: warning: ‘class error_info_base’ has virtual functions
      but non-virtual destructor
 }}}

 Declaring {{{~error_info_base()}}} virtual will avoid the warning and
 allow our sources to include boost headers without having to suppress this
 warning in our own code.

 -- Steve Hartwell

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/4200#comment:8>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:09 UTC