Search code examples
c++callbackns-3

ns3, c++, expression with side effects will be evaluated despite being used as an operand to 'typeid'


Something strange happens: I didn't modify any part of my ns3 c++ code, and running a compilation this is the error that appear:

[ 815/1681] cxx: scratch/initial-scenario.cc -> build/scratch/initial-scenario.cc.1.o
In file included from ../scratch/initial-scenario.cc:3:
In file included from ./ns3/core-module.h:18:
In file included from ./ns3/calendar-scheduler.h:24:
In file included from ./ns3/scheduler.h:25:
In file included from ./ns3/object.h:29:
In file included from ./ns3/object-base.h:23:
In file included from ./ns3/type-id.h:25:
In file included from ./ns3/trace-source-accessor.h:24:
./ns3/callback.h:1244:54: error: expression with side effects will be evaluated despite being used as an operand to 'typeid' [-Werror,-Wpotentially-evaluated-expression]
                        "got=" << Demangle ( typeid (*other).name () ) << std::endl <<
                                                     ^
./ns3/fatal-error.h:98:32: note: expanded from macro 'NS_FATAL_ERROR'
      std::cerr << "msg=\"" << msg << "\", ";           \
                               ^
1 error generated.

I don't understand why this error come out. The strange thing is that I'm working with two similar codes in two different directories and the error appear in both but I didn't modify anything. Could be a problem of the compiler? Any suggestion?


Solution

  • I solve the problem following what is suggested in here: https://www.nsnam.org/wiki/Ns-3.24-errata

    The problem is related to the update of Xcode 7.0