ivanseidel / LinkedList

🔗 A fully implemented LinkedList made to work with general Microcontrollers and Arduino projects
MIT License
347 stars 120 forks source link

non-virtual deconstructor #28

Closed RyanAveryBSU closed 2 years ago

RyanAveryBSU commented 6 years ago

-wall using this class gives me a message about calling delete on a linkedlist<obj> about a non-virtual deconstructor which leads to a undetermined state

RyanAveryBSU commented 6 years ago

edit: this is the warning I am getting when I call delete(myClassList);

warning: deleting object of polymorphic class type 'LinkedList<MyClass*>' which has non-virtual destructor might cause undefined behaviour [-Wdelete-non-virtual-dtor] delete(myClassList);

After some googleing it seems that its not "might cause" but actually "100% does cause" undefined behaviour

Raincode commented 5 years ago

Does MyClass have a virtual destructor? I think this issue can be closed, it is almost a year old and we haven't heard anything new since.

ruigaspar commented 3 years ago

I added a pull request to fix this: https://github.com/ivanseidel/LinkedList/pull/45