[Ns-bugs] [Bug 1367] New: [LLVM] error: using the result of an assignment as a condition without parentheses

code@nsnam.ece.gatech.edu code at nsnam.ece.gatech.edu
Wed Feb 22 03:17:05 PST 2012


https://www.nsnam.org/bugzilla/show_bug.cgi?id=1367

           Summary: [LLVM] error: using the result of an assignment as a
                    condition without parentheses
           Product: ns-3
           Version: ns-3-dev
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: ipv6
        AssignedTo: tommaso.pecorella at unifi.it
        ReportedBy: gjcarneiro at gmail.com
                CC: ns-bugs at isi.edu
   Estimated Hours: 0.0


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.

-- 
Configure bugmail: https://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the Ns-bugs mailing list