Bug 2197 - Clang build error
Clang build error
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: nix-vector
pre-release
PC Linux
: P5 major
Assigned To: John Abraham
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-22 05:31 UTC by natale.patriciello
Modified: 2016-01-04 18:05 UTC (History)
5 users (show)

See Also:


Attachments
Patch to resolve the problem (401 bytes, text/plain)
2015-10-29 08:51 UTC, natale.patriciello
Details

Note You need to log in before you can comment on or make changes to this bug.
Description natale.patriciello 2015-10-22 05:31:12 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.
Comment 1 natale.patriciello 2015-10-29 08:51:43 UTC
Created attachment 2165 [details]
Patch to resolve the problem
Comment 2 Tom Henderson 2016-01-04 18:05:10 UTC
fixed in 11774:51b05c86d144