Skip to content

Bugfix/delete incomplete

Jonathan Fisher requested to merge bugfix/delete-incomplete into develop

This merge request just contains some minor cleanup of the compiler-related cmake scripts. For gcc/clang builds I forced the delete-incomplete warning to become an error. The reason for this is that without forcing this to become an error, the following code will compile

class A;
A* foo();

A* a = foo();
delete a;

however, because A has only been forward-declared, the call to delete will free the memory without ever calling A's destructor. This is very, very dangerous behaviour. Since we recently made changes to prefer forward declarations over including unnecessary headers, forcing this to become an error prevents us from accidentally introducing this kind of bug.

Edited by Jonathan Fisher

Merge request reports