[Webkit-unassigned] [Bug 204714] Move path implementation functions in LineLayoutTraversal to *Path classes

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Nov 30 07:28:55 PST 2019


https://bugs.webkit.org/show_bug.cgi?id=204714

--- Comment #6 from Antti Koivisto <koivisto at iki.fi> ---
> > Source/WebCore/rendering/line/LineLayoutTraversalComplexPath.h:39
> > +        , m_sortedInlineTextBoxes(WTFMove(sortedInlineTextBoxes))
> 
> We do this all over, so maybe there is a good reason for it, but I don't
> think this WTFMove() is necessary. sortedInlineTextBoxes is already an
> rvalue, so the move constructor of m_sortedInlineTextBoxes should be used
> regardless.

This compiles:

struct Bar {
    Bar(Bar&&) = default;
    Bar(const Bar&) = delete;
};

struct Foo {
    Foo(Bar&& bar) : bar(WTFMove(bar)) { }
    Bar bar;
};

This doesn't (Call to deleted constructor of 'Bar'):

struct Foo {
    Foo(Bar&& bar) : bar(bar) { }
    Bar bar;
};

If you leave WTFMove out you'll accidentally invoke copy constructor, if any.

https://en.cppreference.com/w/cpp/utility/move says:

"Names of rvalue reference variables are lvalues and have to be converted to xvalues to be bound to the function overloads that accept rvalue reference parameters"

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20191130/6726b3eb/attachment-0001.htm>


More information about the webkit-unassigned mailing list