Search code examples
c++gccwarningsgnugcc-warning

Making the 'delete' warnings in GCC into errors


I want to make the following warnings in GCC into errors, however, I failed to find any documentation on which switches control them, including the -fdiagnostics-show-option switch.

The warnings are:

deleteing void * is undefined

and

possible problem detected in invocation of delete operator:
'p' has incomplete type

I only want to make the specified warnings into errors, not all of them.


Solution

  • The [enabled by default] part of the warnings (that you didn't show) indicates that there isn't any specific warning flag controlling them, so there isn't anything you can use to say -Wno-xxx or -Werror=xxx.

    With GCC 4.9 you can use -Werror=delete-incomplete to control the second one.