Newly-templated nsTArrayBackInserter::operator=() -> error: no matching constructor for initialization of ...
Categories
(Core :: XPCOM, defect)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox-esr78 | --- | unaffected |
| firefox86 | --- | unaffected |
| firefox87 | --- | unaffected |
| firefox88 | --- | fixed |
People
(Reporter: mozbugz, Assigned: sg)
References
(Regression)
Details
(Keywords: regression)
Attachments
(1 file)
Since bug 1184468 landed, I'm getting errors when building on Windows/x64. Here's one of them:
In file included from Unified_cpp_dom_animation0.cpp:2:
In file included from c:/mozilla-source/mozilla-central/dom/animation/Animation.cpp:7:
In file included from c:/mozilla-source/mozilla-central/dom/animation/Animation.h:12:
In file included from c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/AnimationPerformanceWarning.h:14:
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(631,34): error: no matching constructor for initialization of 'mozilla::Keyframe'
new (static_cast<void*>(aE)) E(std::forward<A>(aArg));
^ ~~~~~~~~~~~~~~~~~~~~~
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(2665,16): note: in instantiation of function template specialization 'nsTArrayElementTraits<mozilla::Keyframe>::Construct<mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>> &>' requested here
elem_traits::Construct(elem, std::forward<Item>(aItem));
^
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(2803,24): note: in instantiation of function template specialization 'nsTArray_Impl<mozilla::Keyframe, nsTArrayInfallibleAllocator>::AppendElementInternal<nsTArrayInfallibleAllocator, mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>> &>' requested here
this->template AppendElementInternal<InfallibleAlloc>(
^
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(3178,13): note: in instantiation of function template specialization 'nsTArray<mozilla::Keyframe>::AppendElement<mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>> &>' requested here
mArray->AppendElement(std::forward<E2>(aValue));
^
C:\PROGRA~2\MICROS~1\2019\PROFES~1\VC\Tools\MSVC\1426~1.288\include\xutility(1389,13): note: in instantiation of function template specialization 'mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>>::operator=<mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>> &>' requested here
_It = static_cast<_UIter&&>(_UIt);
^
c:/mozilla-source/mozilla-central/dom/animation/KeyframeUtils.cpp(1039,8): note: in instantiation of function template specialization 'std::transform<detail::nsTHashtableEntryIterator<nsBaseHashtableET<nsFloatHashKey, mozilla::Keyframe>>, mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>>, (lambda at c:/mozilla-source/mozilla-central/dom/animation/KeyframeUtils.cpp:1040:45)>' requested here
std::transform(processedKeyframes.begin(), processedKeyframes.end(),
^
c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/Keyframe.h(65,3): note: candidate constructor not viable: no known conversion from 'mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>>' to 'const mozilla::Keyframe' for 1st argument
Keyframe(const Keyframe& aOther) = default;
^
c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/Keyframe.h(66,3): note: candidate constructor not viable: no known conversion from 'mozilla::nsTArrayBackInserter<mozilla::Keyframe, nsTArray<mozilla::Keyframe>>' to 'mozilla::Keyframe' for 1st argument
Keyframe(Keyframe&& aOther) = default;
^
c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/Keyframe.h(64,3): note: candidate constructor not viable: requires 0 arguments, but 1 was provided
Keyframe() = default;
^
As far as I can see, it's due to the change in nsTArrayBackInserter, from separate operator=(const E& aValue) and operator=(E&& aValue), to a single templated operator=(E2&& aValue).
Previously, the argument would be taken as pre-determined E (with conversion if needed), and then passed to nsTArray<E>::AppendElement as E.
But now the argument is taken as-is, and forwarded as this templated type E2 to AppendElement, and in there the placement-new construction fails.
Sorry I don't have a better & deeper analysis right now, it's late for me!
I'm not sure why the build doesn't seem to fail on treeherder.
But I did revert just this nsTArrayBackInserter::operator= change locally, and now it builds again for me. So unless that change was really needed (was it?), it could be an easy fix.
Simon, could you please have a look?
| Reporter | ||
Comment 1•4 years ago
•
|
||
In case it helps, here's another error, very similar but with a different array element type:
In file included from Unified_cpp_dom_cache1.cpp:2:
In file included from c:/mozilla-source/mozilla-central/dom/cache/Context.cpp:7:
In file included from c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/dom/cache/Context.h:10:
In file included from c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/dom/SafeRefPtr.h:10:
In file included from c:/mozilla-source/obj-mc-dbg/dist/include\mozilla/ArrayAlgorithm.h:10:
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(631,34): error: no matching constructor for initialization of 'mozilla::dom::cache::HeadersEntry'
new (static_cast<void*>(aE)) E(std::forward<A>(aArg));
^ ~~~~~~~~~~~~~~~~~~~~~
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(2665,16): note: in instantiation of function template specialization 'nsTArrayElementTraits<mozilla::dom::cache::HeadersEntry>::Construct<mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>> &>' requested here
elem_traits::Construct(elem, std::forward<Item>(aItem));
^
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(2803,24): note: in instantiation of function template specialization 'nsTArray_Impl<mozilla::dom::cache::HeadersEntry, nsTArrayInfallibleAllocator>::AppendElementInternal<nsTArrayInfallibleAllocator, mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>> &>' requested here
this->template AppendElementInternal<InfallibleAlloc>(
^
c:/mozilla-source/obj-mc-dbg/dist/include/nsTArray.h(3178,13): note: in instantiation of function template specialization 'nsTArray<mozilla::dom::cache::HeadersEntry>::AppendElement<mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>> &>' requested here
mArray->AppendElement(std::forward<E2>(aValue));
^
C:\PROGRA~2\MICROS~1\2019\PROFES~1\VC\Tools\MSVC\1426~1.288\include\xutility(1389,13): note: in instantiation of function template specialization 'mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>>::operator=<mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>> &>' requested here
_It = static_cast<_UIter&&>(_UIt);
^
c:/mozilla-source/mozilla-central/dom/cache/TypeUtils.cpp(68,8): note: in instantiation of function template specialization 'std::transform<mozilla::ArrayIterator<const mozilla::dom::InternalHeaders::Entry &, nsTArray_Impl<mozilla::dom::InternalHeaders::Entry, nsTArrayInfallibleAllocator>>, mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>>, (lambda at c:/mozilla-source/mozilla-central/dom/cache/TypeUtils.cpp:69:18)>' requested here
std::transform(entryList.cbegin(), entryList.cend(), MakeBackInserter(result),
^
c:/mozilla-source/obj-mc-dbg/ipc/ipdl/_ipdlheaders\mozilla/dom/cache/CacheTypes.h(292,7): note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>>' to 'const mozilla::dom::cache::HeadersEntry' for 1st argument
class HeadersEntry final
^
c:/mozilla-source/obj-mc-dbg/ipc/ipdl/_ipdlheaders\mozilla/dom/cache/CacheTypes.h(292,7): note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'mozilla::nsTArrayBackInserter<mozilla::dom::cache::HeadersEntry, nsTArray<mozilla::dom::cache::HeadersEntry>>' to 'mozilla::dom::cache::HeadersEntry' for 1st argument
c:/mozilla-source/obj-mc-dbg/ipc/ipdl/_ipdlheaders\mozilla/dom/cache/CacheTypes.h(297,18): note: candidate constructor not viable: requires 0 arguments, but 1 was provided
MOZ_IMPLICIT HeadersEntry() :
^
c:/mozilla-source/obj-mc-dbg/ipc/ipdl/_ipdlheaders\mozilla/dom/cache/CacheTypes.h(303,18): note: candidate constructor not viable: requires 2 arguments, but 1 was provided
MOZ_IMPLICIT HeadersEntry(
^
| Reporter | ||
Comment 2•4 years ago
|
||
I managed to build on Mac and Linux without errors, so it's only Windows (for me at least).
| Reporter | ||
Comment 4•4 years ago
|
||
For anyone in the same situation: Until this bug gets properly investigated & fixed, here's a small patch to help build on Windows: https://hg.mozilla.org/try/rev/c970ca811c0f00797336504cefe7ff85bcca7148
(It's reversing the templatization of nsTArrayBackInserter::operator=(), but Simon may have a better solution.)
| Assignee | ||
Updated•4 years ago
|
| Assignee | ||
Comment 5•4 years ago
|
||
While this change wasn't necessary for that patch itself (adding the Keys) function, it's necessary for some use of it to build on Linux. We need to figure out a variant that works on both Linux and Windows.
It's somewhat confusing this doesn't break the Windows builds on Taskcluster.
| Assignee | ||
Comment 6•4 years ago
|
||
Actually, revert the change is fine. Some adaptations need to be applied to https://phabricator.services.mozilla.com/D109056, but that hasn't landed yet.
I'll put up a patch with the reversion suggested by Gerald.
| Assignee | ||
Comment 7•4 years ago
|
||
The changes to nsTArrayBackInserter::operator= broke the builds on Windows
under some circumstances. This reverts those changes. Necessary adaptations
in the stack are made in later patch.
| Assignee | ||
Updated•4 years ago
|
Comment 9•4 years ago
|
||
Set release status flags based on info from the regressing bug 1184468
Updated•4 years ago
|
Updated•4 years ago
|
Description
•