Skip to content

Fix delete of incomplete type

Mattias Ellert requested to merge ellert/HepMC3:incomplete-type into master
/builds/ellert/HepMC3/examples/ViewerExample/src/HepMC3ViewerFrame.cc: In function 'char* create_image_from_dot(char*)':
/builds/ellert/HepMC3/examples/ViewerExample/src/HepMC3ViewerFrame.cc:33:5: warning: possible problem detected in invocation of 'operator delete' [-Wdelete-incomplete]
   33 |     delete gvc;
      |     ^~~~~~~~~~
/builds/ellert/HepMC3/examples/ViewerExample/src/HepMC3ViewerFrame.cc:18:13: warning: 'gvc' has incomplete type
   18 |     GVC_t * gvc=gvContext();
      |             ^~~
In file included from /usr/include/graphviz/types.h:33,
                 from /usr/include/graphviz/gvc.h:14,
                 from /builds/ellert/HepMC3/examples/ViewerExample/src/HepMC3ViewerFrame.cc:13:
/usr/include/graphviz/gvcext.h:54:20: note: forward declaration of 'struct GVC_s'
   54 |     typedef struct GVC_s GVC_t;
      |                    ^~~~~
/builds/ellert/HepMC3/examples/ViewerExample/src/HepMC3ViewerFrame.cc:33:5: note: neither the destructor nor the class-specific 'operator delete' will be called, even if they are declared when the class is defined
   33 |     delete gvc;
      |     ^~~~~~~~~~

Merge request reports