Skip to content

[clang-tidy] 🐛 std::vector(size, value) in modernize-return-braced-init-list  #68159

Closed
@ax3l

Description

@ax3l

Description

The clang-tidy pass modernize-return-braced-init-list complains about constructors of std::vector that are not initializers lists.

In particular, the constructor

vector( size_type count,
                 const T& value,
                 const Allocator& alloc = Allocator() );

should be ignored.

Versions Affected

Bug seen with LLVM 14.

Reproducer

#include <vector>

std::vector<double>
foo()
{
    return std::vector<double>(4, 5);  // {5, 5, 5, 5}

}

https://en.cppreference.com/w/cpp/container/vector/vector

X-Ref

BLAST-WarpX/warpx#4338

Keywords

  • clang-tidy
  • clang-tools-extra

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions