I've found that using operator[ to subscript a String in EditorCommand.cpp fails, the compiler giving the following error: .../WebKit/WebCore/editing/EditorCommand.cpp: In function ‘bool WebCore::executeFormatBlock(WebCore::Frame*, WebCore::Event*, WebCore::EditorCommandSource, const WebCore::String&)’: .../WebKit/WebCore/editing/EditorCommand.cpp:387: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: .../WebKit/WebCore/platform/text/PlatformString.h:72: note: candidate 1: UChar WebCore::String::operator[](unsigned int) const .../WebKit/WebCore/editing/EditorCommand.cpp:387: note: candidate 2: operator[](NSString*, int) <built-in> To resolve the ambiguity, I've used 0U instead of 0 to subscript the String in question.
Created attachment 19714 [details] Use 0U instead of 0
Ick. I hope there is some other way to avoid this error.
Comment on attachment 19714 [details] Use 0U instead of 0 This should only be an issue in Objective-C++ files. The ambiguity comes from the operator NSString*() overload. Why are you seeing this ambiguity in a .cpp file? Are you trying to compile this file as ObjC++?
Comment on attachment 19714 [details] Use 0U instead of 0 I'm going to mark this as review-. The real problem is that this file is being compiled with __OBJC__ defined -- you need to figure out why.
Aside from the specific issues in this .cpp file, we can eliminate this ambiguity in ObjC++ files by overloading the String [] operator for integer types other than unsigned. But once we overload for any type other than unsigned, we'll need overloads for all the integer types we want to allow. Doing that overload would be nice for ObjC++ files -- should not be relevant for this file, though.
Good catch, this file somehow got flipped to sourcecode.cpp.objcpp in my project. I've got a few other filetype things that I've verified do exist in the trunk WebCore.xcodeproj, I'll file separately for those, leaving this bug to be repurposed per comment 5 if desired.
Filetype cleanup mentioned in comment 6 is bug 17833.
I found other uses of 0U to disambiguate between the two choices for operator[] in platform/graphics/mac/IconMac.mm and platform/mac/KeyEvent.mm.