eddic / fastcgipp

fastcgi++: A C++ FastCGI and Web development platform:
https://fastcgipp.isatec.ca
GNU Lesser General Public License v3.0
310 stars 94 forks source link

Missing virtual destructor in Curl_base #99

Closed delperugia closed 3 years ago

delperugia commented 3 years ago

Hi,

while trying to compile using CLang 10, I encounter the following error:

/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/new_allocator.h:153:4: error: destructor called on non-final 'Fastcgipp::Curl_base' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
        { __p->~_Up(); }

which is fixed by adding an empty virtual destructor to the class:

virtual ~Curl_base() {}

Thanks

Full error log:

In file included from /home/vyzyo/sources/fastcgipp/src/curler.cpp:28:
In file included from /home/vyzyo/sources/fastcgipp/include/fastcgi++/curler.hpp:31:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/queue:60:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/deque:64:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/allocator.h:46:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/x86_64-linux-gnu/c++/9/bits/c++allocator.h:33:
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/new_allocator.h:153:4: error: destructor called on non-final 'Fastcgipp::Curl_base' that has virtual functions but non-virtual destructor [-Werror,-Wdelete-non-abstract-non-virtual-dtor]
        { __p->~_Up(); }
          ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/alloc_traits.h:497:8: note: in instantiation of function template specialization '__gnu_cxx::new_allocator<Fastcgipp::Curl_base>::destroy<Fastcgipp::Curl_base>' requested here
        { __a.destroy(__p); }
              ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_deque.h:1611:21: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<Fastcgipp::Curl_base> >::destroy<Fastcgipp::Curl_base>' requested here
            _Alloc_traits::destroy(this->_M_impl,
                           ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/bits/stl_queue.h:295:4: note: in instantiation of member function 'std::deque<Fastcgipp::Curl_base, std::allocator<Fastcgipp::Curl_base> >::pop_front' requested here
        c.pop_front();
          ^
/home/vyzyo/sources/fastcgipp/src/curler.cpp:51:25: note: in instantiation of member function 'std::queue<Fastcgipp::Curl_base, std::deque<Fastcgipp::Curl_base, std::allocator<Fastcgipp::Curl_base> > >::pop' requested here
                m_queue.pop();
                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../../include/c++/9/ext/new_allocator.h:153:10: note: qualify call to silence this warning
        { __p->~_Up(); }
eddic commented 3 years ago

C'mon. Gimme a pull request for this. Don't make me do it myself!!

delperugia commented 3 years ago

Sorry about that, getting lazy these days. Pull request #100 created.