Bug 264442

Summary: Compilation failure using gcc (GCC) 13.2.1 20231011 (Red Hat 13.2.1-4)
Product: WebKit Reporter: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Component: DOMAssignee: Jean-Yves Avenard [:jya] <jean-yves.avenard>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 264393    
Bug Blocks:    

Jean-Yves Avenard [:jya]
Reported 2023-11-08 15:02:58 PST
When compiling with a very recent gcc, we get the compilation error: ``` /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp: In instantiation of ‘WTF::RefPtr<WebCore::Element> WebCore::TreeScopeOrderedMap::get(const WTF::AtomString&, const WebCore::TreeScope&, const KeyMatchingFunction&) const [with KeyMatchingFunction = WebCore::TreeScopeOrderedMap::getElementById(const WTF::AtomString&, const WebCore::TreeScope&) const::<lambda(const WTF::AtomString&, const WebCore::Element&)>]’: /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:180:15: required from here /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:121:5: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 121 | for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) { | ^~~ /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:121:50: note: the temporary was destroyed at the end of the full expression ‘WebCore::descendantsOfType<Element>((* & WebCore::TreeScope::protectedRootNode() const().WTF::Ref<WebCore::ContainerNode>::get()))’ 121 | for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp: In instantiation of ‘WTF::RefPtr<WebCore::Element> WebCore::TreeScopeOrderedMap::get(const WTF::AtomString&, const WebCore::TreeScope&, const KeyMatchingFunction&) const [with KeyMatchingFunction = WebCore::TreeScopeOrderedMap::getElementByName(const WTF::AtomString&, const WebCore::TreeScope&) const::<lambda(const WTF::AtomString&, const WebCore::Element&)>]’: /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:187:15: required from here /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:121:5: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 121 | for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) { | ^~~ /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:121:50: note: the temporary was destroyed at the end of the full expression ‘WebCore::descendantsOfType<Element>((* & WebCore::TreeScope::protectedRootNode() const().WTF::Ref<WebCore::ContainerNode>::get()))’ 121 | for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp: In instantiation of ‘WTF::RefPtr<WebCore::Element> WebCore::TreeScopeOrderedMap::get(const WTF::AtomString&, const WebCore::TreeScope&, const KeyMatchingFunction&) const [with KeyMatchingFunction = WebCore::TreeScopeOrderedMap::getElementByMapName(const WTF::AtomString&, const WebCore::TreeScope&) const::<lambda(const WTF::AtomString&, const WebCore::Element&)>]’: /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:194:40: required from here /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:121:5: error: possibly dangling reference to a temporary [-Werror=dangling-reference] 121 | for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) { | ^~~ /home/jyavenard/Work/webkit/OpenSource/Source/WebCore/dom/TreeScopeOrderedMap.cpp:121:50: note: the temporary was destroyed at the end of the full expression ‘WebCore::descendantsOfType<Element>((* & WebCore::TreeScope::protectedRootNode() const().WTF::Ref<WebCore::ContainerNode>::get()))’ 121 | for (Ref element : descendantsOfType<Element>(scope.protectedRootNode().get())) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
Attachments
Radar WebKit Bug Importer
Comment 1 2023-11-08 15:03:28 PST
Jean-Yves Avenard [:jya]
Comment 2 2023-11-08 15:46:29 PST
EWS
Comment 3 2023-11-08 22:33:53 PST
Committed 270421@main (f738f4311526): <https://commits.webkit.org/270421@main> Reviewed commits have been landed. Closing PR #20193 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.