Skip to content

bugprone-use-after-move misses use in constructor initializer #51844

@FabianWolff

Description

@FabianWolff
Bugzilla Link 52502
Version unspecified
OS Linux

Extended Description

Bug 38187 is fixed by https://reviews.llvm.org/D113708, but the following example (where both the move and the use-after-move occur in the constructor's initializer list) still does not cause a bugprone-use-after-move warning:

#include

class UseAfterMoveInCtorInit {
public:
// FIXME: warn here
UseAfterMoveInCtorInit(std::string val) : s(std::move(val)), b(val.empty()) {
}

private:
std::string s;
bool b;
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions