RESOLVED FIXED Bug 215550
[WTF] HashTable<Ref<K>, V>::HashTable(const HashTable& other) can't compile
https://bugs.webkit.org/show_bug.cgi?id=215550
Summary [WTF] HashTable<Ref<K>, V>::HashTable(const HashTable& other) can't compile
Fujii Hironori
Reported 2020-08-16 13:20:12 PDT
Created attachment 406685 [details] test case [WTF] HashTable<>::HashTable(const HashTable& other) can't compile
Attachments
test case (1.21 KB, patch)
2020-08-16 13:20 PDT, Fujii Hironori
no flags
WIP patch (2.96 KB, patch)
2020-08-16 19:00 PDT, Fujii Hironori
no flags
Patch (4.83 KB, patch)
2020-08-16 21:42 PDT, Fujii Hironori
no flags
Patch (4.83 KB, patch)
2020-08-17 00:15 PDT, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2020-08-16 13:27:27 PDT
The error message from GTK EWS bot: [4/116] Building CXX object Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/HashSet.cpp.o FAILED: Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/HashSet.cpp.o /usr/bin/ccache /usr/bin/c++ -DBUILDING_GTK__=1 -DBUILDING_TestWTF -DBUILDING_WITH_CMAKE=1 -DGETTEXT_PACKAGE=\"WebKit2GTK-4.0\" -DGTEST_CREATE_SHARED_LIBRARY=1 -DGTEST_HAS_PTHREAD=1 -DGTEST_HAS_RTTI=0 -DHAVE_CONFIG_H=1 -DJSC_GLIB_API_ENABLED -DSVN_REVISION=\"r265735\" -DWEBKITGTK_API_VERSION_STRING=\"4.0\" -I. -I../../Tools/TestWebKitAPI -I../../Source/ThirdParty/gtest/include -IDerivedSources/ForwardingHeaders -isystem /usr/include/glib-2.0 -isystem /usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/gtk-3.0 -isystem /usr/include/pango-1.0 -isystem /usr/lib/x86_64-linux-gnu/libffi-3.2.1/include -isystem /usr/include/harfbuzz -isystem /usr/include/libmount -isystem /usr/include/blkid -isystem /usr/include/fribidi -isystem /usr/include/freetype2 -isystem /usr/include/libpng16 -isystem /usr/include/cairo -isystem /usr/include/pixman-1 -isystem /usr/include/gdk-pixbuf-2.0 -isystem /usr/include/gio-unix-2.0 -isystem /usr/include/atk-1.0 -isystem /usr/include/at-spi2-atk/2.0 -isystem /usr/include/at-spi-2.0 -isystem /usr/include/dbus-1.0 -isystem /usr/lib/x86_64-linux-gnu/dbus-1.0/include -fdiagnostics-color=always -Wextra -Wall -Wno-expansion-to-defined -Wno-noexcept-type -Wno-psabi -Wno-maybe-uninitialized -Wwrite-strings -Wundef -Wpointer-arith -Wmissing-format-attribute -Wformat-security -Wcast-align -fno-strict-aliasing -fno-exceptions -fno-rtti -O3 -DNDEBUG -fPIE -Wno-dangling-else -Wno-sign-compare -Wno-undef -Wno-unused-parameter -pthread -std=c++17 -MD -MT Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/HashSet.cpp.o -MF Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/HashSet.cpp.o.d -o Tools/TestWebKitAPI/CMakeFiles/TestWTF.dir/Tests/WTF/HashSet.cpp.o -c ../../Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp In file included from DerivedSources/ForwardingHeaders/wtf/HashSet.h:26, from ../../Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp:34: DerivedSources/ForwardingHeaders/wtf/HashTable.h: In instantiation of ‘static void WTF::IdentityHashTranslator<ValueTraits, HashFunctions>::translate(T&, const U&, V&&) [with T = WTF::Ref<TestWebKitAPI::RefLogger>; U = WTF::Ref<TestWebKitAPI::RefLogger>; V = const WTF::Ref<TestWebKitAPI::RefLogger>&; ValueTraits = WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger> >; HashFunctions = WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger> >]’: DerivedSources/ForwardingHeaders/wtf/HashTable.h:890:34: required from ‘void WTF::HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::addUniqueForInitialization(T&&, Extra&&) [with HashTranslator = WTF::IdentityHashTranslator<WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger> >, WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger> > >; T = const WTF::Ref<TestWebKitAPI::RefLogger>&; Extra = const WTF::Ref<TestWebKitAPI::RefLogger>&; Key = WTF::Ref<TestWebKitAPI::RefLogger>; Value = WTF::Ref<TestWebKitAPI::RefLogger>; Extractor = WTF::IdentityExtractor; HashFunctions = WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger> >; Traits = WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger> >; KeyTraits = WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger> >]’ DerivedSources/ForwardingHeaders/wtf/HashTable.h:1398:13: required from ‘WTF::HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>::HashTable(const WTF::HashTable<Key, Value, Extractor, HashFunctions, Traits, KeyTraits>&) [with Key = WTF::Ref<TestWebKitAPI::RefLogger>; Value = WTF::Ref<TestWebKitAPI::RefLogger>; Extractor = WTF::IdentityExtractor; HashFunctions = WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger> >; Traits = WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger> >; KeyTraits = WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger> >]’ DerivedSources/ForwardingHeaders/wtf/HashSet.h:33:7: required from here DerivedSources/ForwardingHeaders/wtf/HashTable.h:293:39: error: cannot bind rvalue reference of type ‘WTF::Ref<TestWebKitAPI::RefLogger>&&’ to lvalue of type ‘const WTF::Ref<TestWebKitAPI::RefLogger>’ 293 | ValueTraits::assignToEmpty(location, std::forward<V>(value)); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from ../../Tools/TestWebKitAPI/Tests/WTF/DeletedAddressOfOperator.h:29, from ../../Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp:29: DerivedSources/ForwardingHeaders/wtf/HashTraits.h:211:60: note: initializing argument 2 of ‘static void WTF::RefHashTraits<P>::assignToEmpty(WTF::Ref<T>&, WTF::Ref<T>&&) [with P = TestWebKitAPI::RefLogger]’ 211 | static void assignToEmpty(Ref<P>& emptyValue, Ref<P>&& newValue) { ASSERT(isEmptyValue(emptyValue)); emptyValue.assignToHashTableEmptyValue(WTFMove(newValue)); } | ~~~~~~~~~^~~~~~~~
Fujii Hironori
Comment 2 2020-08-16 13:36:46 PDT
The error message from watchOS EWS bot: The following build commands failed: CompileC /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/TestWebKitAPI.build/Release-watchos/TestWTFLibrary.build/Objects-normal/arm64_32/HashSet.o Tests/WTF/HashSet.cpp normal arm64_32 c++ com.apple.compilers.llvm.clang.1_0.compiler CompileC /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/TestWebKitAPI.build/Release-watchos/TestWTFLibrary.build/Objects-normal/armv7k/HashSet.o Tests/WTF/HashSet.cpp normal armv7k c++ com.apple.compilers.llvm.clang.1_0.compiler (2 failures) program finished with exit code 65 elapsedTime=567.723258 In file included from /Volumes/Data/worker/watchOS-6-Build-EWS/build/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp:34: In file included from /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/Release-watchos/usr/local/include/wtf/HashSet.h:26: /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/Release-watchos/usr/local/include/wtf/HashTable.h:293:50: error: binding value of type 'const Ref<...>' to reference to type 'Ref<...>' drops 'const' qualifier ValueTraits::assignToEmpty(location, std::forward<V>(value)); ^~~~~~~~~~~~~~~~~~~~~~ /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/Release-watchos/usr/local/include/wtf/HashTable.h:890:25: note: in instantiation of function template specialization 'WTF::IdentityHashTranslator<WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > >, WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > > >::translate<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> >, WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> >, const WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > &>' requested here HashTranslator::translate(*entry, std::forward<T>(key), std::forward<Extra>(extra)); ^ /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/Release-watchos/usr/local/include/wtf/HashTable.h:1398:13: note: in instantiation of function template specialization 'WTF::HashTable<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> >, WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> >, WTF::IdentityExtractor, WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > >, WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > >, WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > > >::addUniqueForInitialization<WTF::IdentityHashTranslator<WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > >, WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > > >, const WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > &, const WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > &>' requested here addUniqueForInitialization<IdentityTranslatorType>(Extractor::extract(otherValue), otherValue); ^ In file included from /Volumes/Data/worker/watchOS-6-Build-EWS/build/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp:34: /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/Release-watchos/usr/local/include/wtf/HashSet.h:33:7: note: in instantiation of member function 'WTF::HashTable<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> >, WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> >, WTF::IdentityExtractor, WTF::DefaultHash<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > >, WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > >, WTF::HashTraits<WTF::Ref<TestWebKitAPI::RefLogger, WTF::DumbPtrTraits<TestWebKitAPI::RefLogger> > > >::HashTable' requested here class HashSet final { ^ In file included from /Volumes/Data/worker/watchOS-6-Build-EWS/build/Tools/TestWebKitAPI/Tests/WTF/HashSet.cpp:29: In file included from /Volumes/Data/worker/watchOS-6-Build-EWS/build/Tools/TestWebKitAPI/Tests/WTF/DeletedAddressOfOperator.h:29: /Volumes/Data/worker/watchOS-6-Build-EWS/build/WebKitBuild/Release-watchos/usr/local/include/wtf/HashTraits.h:211:60: note: passing argument to parameter 'newValue' here static void assignToEmpty(Ref<P>& emptyValue, Ref<P>&& newValue) { ASSERT(isEmptyValue(emptyValue)); emptyValue.assignToHashTableEmptyValue(WTFM ove(newValue)); } ^ 1 error generated.
Darin Adler
Comment 3 2020-08-16 14:36:42 PDT
I suspect we can fix this by: 1) Using std::forward instead of WTFMove in assignToEmpty. 2) Overloading assignToHashTableEmptyValue for both Ref&& and const Ref&. But that may not be correct.
Fujii Hironori
Comment 4 2020-08-16 18:58:27 PDT
I don't understand why assignToEmpty and assignToHashTableEmptyValue are needed. I'm going to upload a patch to remove them.
Fujii Hironori
Comment 5 2020-08-16 19:00:05 PDT
Created attachment 406692 [details] WIP patch
Fujii Hironori
Comment 6 2020-08-16 21:42:05 PDT
Fujii Hironori
Comment 7 2020-08-17 00:15:04 PDT
Fujii Hironori
Comment 8 2020-08-17 14:35:52 PDT
Comment on attachment 406700 [details] Patch Clearing flags on attachment: 406700 Committed r265773: <https://trac.webkit.org/changeset/265773>
Fujii Hironori
Comment 9 2020-08-17 14:35:56 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10 2020-08-17 14:36:13 PDT
Note You need to log in before you can comment on or make changes to this bug.