[Zeek-Dev] Question about IntrusivePtr and incomplete types

Johanna Amann johanna at corelight.com
Tue Dec 17 06:24:10 PST 2019


I just tried to use our new IntrusivePtr type for the first time - and 
encountered a (for me) unexpected problem.

In my specific case, I want to introduce a new member variable for 
TableVal. The type of it is:

   IntrusivePtr<Expr> change_func;

Compiling Zeek with this addition to the TableVal class will yield in 
the following compilation error:

  -DDOCTEST_CONFIG_DISABLE -Isrc/zeekygen -I../src/zeekygen -Isrc 
-I../src -I/opt/local/include -Iaux/binpac/lib -I../aux/binpac/lib 
-I../aux/paraglob/include -I../aux/broker/3rdparty/caf/libcaf_test 
-I../aux/broker/3rdparty/caf/libcaf_core -Iaux/broker/include 
-I../aux/broker/include -I. -Wall -Wno-unused -g -DDEBUG -DBRO_DEBUG 
-Wno-register -std=c++17 -g -isysroot 
-mmacosx-version-min=10.14 -MD -MT 
src/zeekygen/CMakeFiles/bro_zeekygen.dir/ScriptInfo.cc.o -MF 
src/zeekygen/CMakeFiles/bro_zeekygen.dir/ScriptInfo.cc.o.d -o 
src/zeekygen/CMakeFiles/bro_zeekygen.dir/ScriptInfo.cc.o -c 
In file included from ../src/zeekygen/ScriptInfo.cc:7:
In file included from ../src/zeekygen/Manager.h:14:
In file included from ../src/Val.h:23:
../src/IntrusivePtr.h:88:4: error: no matching function for call to 
../src/Val.h:903:2: note: in instantiation of member function 
'IntrusivePtr<Expr>::~IntrusivePtr' requested here
         TableVal()      {}
../src/Obj.h:199:13: note: candidate function not viable: cannot convert 
argument of incomplete type 'IntrusivePtr<Expr>::pointer' (aka 'Expr *') 
to 'BroObj *' for 1st argument
inline void Unref(BroObj* o)
Including Expr.h in Val.h is not trivially possible due to other 
ordering conflicts breaking the build.

Is there some way to use an IntrusivePtr in this case - or is is just 
not possible to use it in cases where it is not possible to use complete 


More information about the Zeek-Dev mailing list