Skip to content

modernize-avoid-c-arrays clang-tidy warning when using NLOHMANN_JSON_SERIALIZE_ENUM macro #3924

@alzix

Description

@alzix

Description

clang-tidy emits a warning on a code using NLOHMANN_JSON_SERIALIZE_ENUM,
this requires to to put no-lint comments on the usage code

Reproduction steps

run clang-tidy on the code using NLOHMANN_JSON_SERIALIZE_ENUM macro

Expected vs. actual results

expected no warnings

Minimal code example

++
enum class Foo {
  kFoo1,
  kFoo2
};
NLOHMANN_JSON_SERIALIZE_ENUM(
    Foo,
    {
        {Foo::kFoo1, "FOO1"},
        {Foo::kFoo2, "FOO2"},
    })

Error messages

| Clang-Tidy: Do not declare C-style arrays, use std::array<> instead

Compiler and operating system

Apple clang version 14.0.0, MacOS

Library version

v3.11.2

Validation

Metadata

Metadata

Assignees

Labels

kind: bugsolution: proposed fixa fix for the issue has been proposed and waits for confirmation

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions