Skip to content

modernize-use-std-format clang tidy warning not working on example code from documentation #129484

@belobrov-andrey

Description

@belobrov-andrey

After upgrading project to С++20 and enabling modernize-use-std-format warning there is modernize-use-std-format clang tidy warning:
Unable to use 'std::format' instead of 'StrFormat' because first argument is not a narrow string literal [modernize-use-std-format]
The minimal code sample to reproduce problem (sample from documentation):

#include <absl/strings/str_format.h>

#include <string>

std::string getDescription(const std::string& description, int value)
{
    return absl::StrFormat("The %s is %3d", description.c_str(), value);
}

Compile options: -g -stdlib=libc++ -std=c++20

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions