Open Bug 1633345 Opened 3 years ago Updated 6 months ago

Cannot use structured binding with mozilla::Tuple

Categories

(Core :: MFBT, defect)

defect

Tracking

()

People

(Reporter: sg, Unassigned)

References

Details

Attachments

(1 file)

When trying to use a structured binding with a mozilla::Tuple<uint64_t, bool, mozilla::Span<const uint8_t>>, I get a syntax error:

/home/simon/work/mozilla-unified/dom/indexedDB/ActorsParent.cpp:792:16: error: cannot decompose class type 'Tuple<long, bool, mozilla::Span<const unsigned char, 18446744073709551615> >': its base classes 'TupleImpl<0, long, bool, mozilla::Span<const unsigned char, 18446744073709551615> >' and 'TupleImpl<0UL + 1, bool, mozilla::Span<const unsigned char, 18446744073709551615> >' have non-static data members
    const auto [indexId, unique, remainderAfterIndexId] =

Not sure if it's a priority to fix this, given Bug 1276351 saying that mozilla::Tuple should be replaced by std::tuple.

Allows using C++17 structured bindings with mozilla::Tuple. Also fixes an issue where mozilla::Tuple turns some explicit casts into implicit ones.

The patch is a WIP until it gets some test added to TestTuple but it works. But I figured I'd ask first -- do we still want to land this given bug 1276351?

Flags: needinfo?(simon.giesecke)
Flags: needinfo?(simon.giesecke)
You need to log in before you can comment on or make changes to this bug.