Bugzilla – Bug 2197
Clang build error
Last modified: 2016-01-04 18:05:10 UTC
Configure ns-3 with $ CXX="clang++" CC="clang" ./waf configure --enable-examples --enable-tests clang version: 3.7.0 $ clang -v clang version 3.7.0 (tags/RELEASE_370/final) Target: x86_64-unknown-linux-gnu Thread model: posix Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.2.0 Found candidate GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-unknown-linux-gnu/5.2.0 Found candidate GCC installation: /usr/lib64/gcc/x86_64-unknown-linux-gnu/5.2.0 Selected GCC installation: /usr/bin/../lib64/gcc/x86_64-unknown-linux-gnu/5.2.0 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Selected multilib: .;@m64 The error is the following: ../src/nix-vector-routing/examples/nms-p2p-nix.cc:79:9: error: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Werror,-Wmismatched-new-delete] delete p; ^ [] ../src/nix-vector-routing/examples/nms-p2p-nix.cc:149:26: note: in instantiation of member function 'Array2D<ns3::NodeContainer>::~Array2D' requested here Array2D<NodeContainer> nodes_net0(nCN, 3); ^ ../src/nix-vector-routing/examples/nms-p2p-nix.cc:69:51: note: allocated with 'new[]' here Array2D (const size_t x, const size_t y) : p (new T*[x]), m_xMax (x) ^ ../src/nix-vector-routing/examples/nms-p2p-nix.cc:79:9: error: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Werror,-Wmismatched-new-delete] delete p; ^ [] ../src/nix-vector-routing/examples/nms-p2p-nix.cc:160:35: note: in instantiation of member function 'Array2D<ns3::Ipv4InterfaceContainer>::~Array2D' requested here Array2D<Ipv4InterfaceContainer> ifs0(nCN, 3); ^ ../src/nix-vector-routing/examples/nms-p2p-nix.cc:69:51: note: allocated with 'new[]' here Array2D (const size_t x, const size_t y) : p (new T*[x]), m_xMax (x) ^ ../src/nix-vector-routing/examples/nms-p2p-nix.cc:79:9: error: 'delete' applied to a pointer that was allocated with 'new[]'; did you mean 'delete[]'? [-Werror,-Wmismatched-new-delete] delete p; ^ [] ../src/nix-vector-routing/examples/nms-p2p-nix.cc:266:35: note: in instantiation of member function 'Array2D<ns3::NetDeviceContainer>::~Array2D' requested here Array2D<NetDeviceContainer> ndc2LAN(7, nLANClients); ^ ../src/nix-vector-routing/examples/nms-p2p-nix.cc:69:51: note: allocated with 'new[]' here Array2D (const size_t x, const size_t y) : p (new T*[x]), m_xMax (x) ^ 3 errors generated. Patching is trivial.
Created attachment 2165 [details] Patch to resolve the problem
fixed in 11774:51b05c86d144