[LLVMbugs] [Bug 10140] New: StringPool's PooledStringPtr has non-const operator== causing bad OR-result
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Jun 15 01:21:47 PDT 2011
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: unassignedbugs at nondot.org
ReportedBy: schaub.johannes at googlemail.com
CC: llvmbugs at cs.uiuc.edu
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.
More information about the llvm-bugs
mailing list