RESOLVED FIXED 234412
REGRESSION(r287138) [GLIB] Build failure with GCC 8 and 9 in std::array to Span conversion
https://bugs.webkit.org/show_bug.cgi?id=234412
Summary REGRESSION(r287138) [GLIB] Build failure with GCC 8 and 9 in std::array to Sp...
Lauro Moura
Reported 2021-12-16 17:29:29 PST
Created attachment 447403 [details] Example that fails with GCC-9 and builds with GCC-10 Attached minimal example built with snippets from Span.h and its usage in AccessibilityRenderObject.cpp (Link to compiler explorer: https://godbolt.org/z/qxTK1qdda) Minimum GCC working version: gcc 10 Minimum CLANG working version: clang 7 List of C++ features supported by GCC: https://gcc.gnu.org/projects/cxx-status.html List of C++ GCC 10 changes: https://gcc.gnu.org/gcc-10/changes.html#cxx Link to build job of the first failure: https://build.webkit.org/#/builders/46/builds/9542 ../../Source/WebCore/accessibility/AccessibilityRenderObject.cpp: In member function ‘virtual bool WebCore::AccessibilityRenderObject::inheritsPresentationalRole() const’: ../../Source/WebCore/accessibility/AccessibilityRenderObject.cpp:3222:22: error: no match for ‘operator=’ (operand types are ‘WTF::Span<const WTF::LazyNeverDestroyed<const WebCore::HTMLQualifiedName>* const>’ and ‘const std::array<WTF::LazyNeverDestroyed<const WebCore::HTMLQualifiedName>*, 3>’) parentTags = listItemParents; ^~~~~~~~~~~~~~~ In file included from WTF/Headers/wtf/Vector.h:37, from WTF/Headers/wtf/Threading.h:48, from WTF/Headers/wtf/WeakPtr.h:31, from WTF/Headers/wtf/text/TextStream.h:33, from WTF/Headers/wtf/ObjectIdentifier.h:32, from ../../Source/WebCore/page/FrameIdentifier.h:28, from ../../Source/WebCore/loader/FrameLoaderClient.h:32, from ../../Source/WebCore/accessibility/AccessibilityObjectInterface.h:30, from ../../Source/WebCore/accessibility/AccessibilityObject.h:32, from ../../Source/WebCore/accessibility/AccessibilityMockObject.h:28, from ../../Source/WebCore/accessibility/AccessibilityMockObject.cpp:27, from WebCore/DerivedSources/unified-sources/UnifiedSource-aba958d6-3.cpp:1: WTF/Headers/wtf/Span.h:289:21: note: candidate: ‘constexpr WTF::Span<_Tp, 18446744073709551615>& WTF::Span<_Tp, 18446744073709551615>::operator=(const WTF::Span<_Tp, 18446744073709551615>&) [with _Tp = const WTF::LazyNeverDestroyed<const WebCore::HTMLQualifiedName>* const]’ constexpr Span& operator=(const Span&) noexcept = default; ^~~~~~~~ WTF/Headers/wtf/Span.h:289:21: note: no known conversion for argument 1 from ‘const std::array<WTF::LazyNeverDestroyed<const WebCore::HTMLQualifiedName>*, 3>’ to ‘const WTF::Span<const WTF::LazyNeverDestroyed<const WebCore::HTMLQualifiedName>* const>&’ In file included from WebCore/DerivedSources/unified-sources/UnifiedSource-aba958d6-3.cpp:5:
Attachments
Example that fails with GCC-9 and builds with GCC-10 (8.67 KB, text/x-c++src)
2021-12-16 17:29 PST, Lauro Moura
no flags
Patch (1.75 KB, patch)
2021-12-16 19:42 PST, Carlos Alberto Lopez Perez
ews-feeder: commit-queue-
Carlos Alberto Lopez Perez
Comment 1 2021-12-16 18:32:17 PST
GCC 8 also fails with the same error than GCC 9 (GCC 8 is still supported) The example builds fine with "-std=c++17" on GCC-10 but not on 9 and 10. And according to https://gcc.gnu.org/projects/cxx-status.html GCC 8 already has full support for C++-17 So maybe this is a bug on the compiler, hard to tell.
Darin Adler
Comment 2 2021-12-16 18:35:22 PST
Would be nice to find a workaround too.
Carlos Alberto Lopez Perez
Comment 3 2021-12-16 18:40:26 PST
This info is maybe useful, Clang 6 fails with the same error (or very similar). $ clang++-6.0 -std=c++17 span_gcc.cpp span_gcc.cpp:211:10: error: no viable overloaded '=' span = arr; ~~~~ ^ ~~~ span_gcc.cpp:150:21: note: candidate function not viable: no known conversion from 'const std::array<int *, 3>' to 'const Span<const int *const, 18446744073709551615>' for 1st argument constexpr Span& operator=(const Span&) noexcept = default; ^ 1 error generated. And clang++-7 builds it fine
Carlos Alberto Lopez Perez
Comment 4 2021-12-16 19:42:17 PST
EWS
Comment 5 2021-12-16 22:02:30 PST
Committed r287173 (245343@main): <https://commits.webkit.org/245343@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 447413 [details].
Radar WebKit Bug Importer
Comment 6 2021-12-16 22:03:20 PST
Note You need to log in before you can comment on or make changes to this bug.