http://llvm.org/bugs/show_bug.cgi?id=10140

           Summary: StringPool's PooledStringPtr has non-const operator==
                    causing bad OR-result
           Product: libraries
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Support Libraries
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


This just caused me some hours of debugging fun:

class LexedIdentifier {
...
   bool equals(LexedIdentifier const& other) const {
      return other.m_ident == m_ident;
   }

   llvm::PooledStringPtr m_ident;
...
};

Rather than comparing both PooledStringPtr, it converted both to "bool" and
compared those booleans, because the respective operator== of PooledStringPtr
is non-const, hence is not preferred by the compiler!

// Support/StringPool.h
00131     inline operator bool() const { return S != 0; }
00132 
00133     inline bool operator==(const PooledStringPtr &That) { return S ==
That.S; }

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to