[Win][Clang][DumpRenderTree] Add a constructor of AccessibilityUIElement for 0 or nullptr While trying to build WebKit WinCairo port with the latest Clang (Bug 171618), the following compilation error is reported. > [9/31] Building CXX object Tools\DumpRenderTree\CMakeFiles\DumpRenderTreeLib.dir\AccessibilityUIElement.cpp.obj > FAILED: Tools/DumpRenderTree/CMakeFiles/DumpRenderTreeLib.dir/AccessibilityUIElement.cpp.obj > C:\tools\llvm\bin\clang-cl.exe (...) /FoTools\DumpRenderTree\CMakeFiles\DumpRenderTreeLib.dir\AccessibilityUIElement.cpp.obj /FdTools\DumpRenderTree\CMakeFiles\DumpRenderTreeLib.dir\ -c ..\..\Tools\DumpRenderTree\AccessibilityUIElement.cpp > ..\..\Tools\DumpRenderTree\AccessibilityUIElement.cpp(1564,85): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > AccessibilityUIElement AccessibilityUIElement::horizontalScrollbar() const { return 0; } > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(66,5): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement(PlatformUIElement); > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(67,5): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement(const AccessibilityUIElement&); > ^ > ..\..\Tools\DumpRenderTree\AccessibilityUIElement.cpp(1565,83): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > AccessibilityUIElement AccessibilityUIElement::verticalScrollbar() const { return 0; } > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(66,5): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement(PlatformUIElement); > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(67,5): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement(const AccessibilityUIElement&); > ^ > ..\..\Tools\DumpRenderTree\AccessibilityUIElement.cpp(1566,100): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > AccessibilityUIElement AccessibilityUIElement::uiElementAttributeValue(JSStringRef) const { return 0; } > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(66,5): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement(PlatformUIElement); > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(67,5): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement(const AccessibilityUIElement&); > ^ > ..\..\Tools\DumpRenderTree\AccessibilityUIElement.cpp(1635,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(66,5): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement(PlatformUIElement); > ^ > ..\..\Tools\DumpRenderTree/AccessibilityUIElement.h(67,5): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement(const AccessibilityUIElement&); > ^ > 4 errors generated. > [10/31] Building CXX object Tools\DumpRenderTree\CMakeFiles\DumpRenderTreeLib.dir\win\AccessibilityUIElementWin.cpp.obj > FAILED: Tools/DumpRenderTree/CMakeFiles/DumpRenderTreeLib.dir/win/AccessibilityUIElementWin.cpp.obj > C:\tools\llvm\bin\clang-cl.exe (...) /FoTools\DumpRenderTree\CMakeFiles\DumpRenderTreeLib.dir\win\AccessibilityUIElementWin.cpp.obj /FdTools\DumpRenderTree\CMakeFiles\DumpRenderTreeLib.dir\ -c ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(136,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(142,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(148,16): error: no viable conversion from returned value of type 'nullptr_t' to function return type 'AccessibilityUIElement' > return nullptr; > ^~~~~~~ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(156,16): error: no viable conversion from returned value of type 'nullptr_t' to function return type 'AccessibilityUIElement' > return nullptr; > ^~~~~~~ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(187,16): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(192,16): error: no viable conversion from returned value of type 'nullptr_t' to function return type 'AccessibilityUIElement' > return nullptr; > ^~~~~~~ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(195,16): error: no viable conversion from returned value of type 'nullptr_t' to function return type 'AccessibilityUIElement' > return nullptr; > ^~~~~~~ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(200,16): error: no viable conversion from returned value of type 'nullptr_t' to function return type 'AccessibilityUIElement' > return nullptr; > ^~~~~~~ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(210,16): error: no viable conversion from returned value of type 'nullptr_t' to function return type 'AccessibilityUIElement' > return nullptr; > ^~~~~~~ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'nullptr_t' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(672,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(682,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(758,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(763,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(768,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(773,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(778,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(783,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(788,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(967,12): error: no viable conversion from returned value of type 'int' to function return type 'AccessibilityUIElement' > return 0; > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(51,25): note: candidate constructor not viable: no known conversion from 'int' to 'PlatformUIElement' (aka 'COMPtr<IAccessible>') for 1st argument > AccessibilityUIElement::AccessibilityUIElement(PlatformUIElement element) > ^ > ..\..\Tools\DumpRenderTree\win\AccessibilityUIElementWin.cpp(56,25): note: candidate constructor not viable: no known conversion from 'int' to 'const AccessibilityUIElement &' for 1st argument > AccessibilityUIElement::AccessibilityUIElement(const AccessibilityUIElement& other) > ^ > 19 errors generated.
I created a repro. This source can be compiled by MSVC, but by GCC and Clang. https://godbolt.org/z/cL3sGK
https://en.cppreference.com/w/cpp/language/implicit_conversion > 2) zero or one user-defined conversion; It seems that implicit conversions allows only one user-defined conversion.
Created attachment 349377 [details] Patch
Comment on attachment 349377 [details] Patch replace nullptr with AccessibilityUIElement(nullptr) instead.
Or maybe replace 0 with { nullptr }. Something like that. A windows-specific constructor isn't the answer.
Umm, the reason why I don't like your idea is it can cause compilation errors only for Windows Clang builds while it compiles on other ports if someone will add a new code just putting nullptr. Other ports typedef PlatformUIElement just to a simple pointer. > typedef AtkObject* PlatformUIElement; What about an idea not to use COMPtr? Just use IAccessible*. > typedef IAccessible* PlatformUIElement; I will submit a propose patch.
Created attachment 349509 [details] WIP patch Umm. Too many ".get()" without using windows-specific constructor. I will submit a patch following your propose.
Created attachment 349513 [details] Patch
Comment on attachment 349513 [details] Patch Great!
Comment on attachment 349513 [details] Patch Clearing flags on attachment: 349513 Committed r235941: <https://trac.webkit.org/changeset/235941>
All reviewed patches have been landed. Closing bug.
<rdar://problem/44386055>