Bug 1367 - [LLVM] error: using the result of an assignment as a condition without parentheses
[LLVM] error: using the result of an assignment as a condition without parent...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: ipv6
ns-3-dev
All All
: P5 normal
Assigned To: Tommaso Pecorella
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-22 06:17 UTC by Gustavo J. A. M. Carneiro
Modified: 2012-02-23 18:26 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gustavo J. A. M. Carneiro 2012-02-22 06:17:04 UTC
With clang++ (LLVM):

[ 838/1334] cxx: src/internet/model/ipv6-interface.cc -> build/src/internet/model/ipv6-interface.cc.1.o
11:15:47 runner ['/usr/bin/clang++', '-O0', '-ggdb', '-g3', '-Wall', '-Werror', '-Wno-error=deprecated-declarations', '-fstrict-aliasing', '-Wstrict-aliasing', '-Wno-array-bounds', '-fPIC', '-pthread', '-Ibuild', '-I.', '-DNS3_ASSERT_ENABLE', '-DNS3_LOG_ENABLE', '-DSQLITE3=1', '-DHAVE_IF_TUN_H=1', '-DENABLE_GSL', '../src/internet/model/ipv6-interface.cc', '-c', '-o', 'src/internet/model/ipv6-interface.cc.1.o']
../src/internet/model/ipv6-l3-protocol.cc:436:18: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
      if (device = DynamicCast<LoopbackNetDevice> (m_node->GetDevice (i)))
          ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/internet/model/ipv6-l3-protocol.cc:436:18: note: use '==' to turn this assignment into an equality comparison
      if (device = DynamicCast<LoopbackNetDevice> (m_node->GetDevice (i)))
                 ^
                 ==
../src/internet/model/ipv6-l3-protocol.cc:436:18: note: place parentheses around the assignment to silence this warning
      if (device = DynamicCast<LoopbackNetDevice> (m_node->GetDevice (i)))
                 ^
          (                                                              )
1 error generated.

It just needs extra parenthesis around the assignment.
Comment 1 Tommaso Pecorella 2012-02-23 18:26:22 UTC
Fixed, changeset 7739 - b521459d9d27