Skip to content

[clang-tidy][C++20] False negative modernize-use-emplace with aggregate types #115841

@chrchr-github

Description

@chrchr-github
#include <vector>

struct S {
    //S(int i, int j) : a(i), b(j) {} // warning with this
    int a, b;
};

void f(std::vector<S>& v) {
    v.push_back(S{ 1, 2 }); // FN
    v.emplace_back(1, 2);
}

https://godbolt.org/z/GKWEjT5sE

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