Skip to content

[clang-tidy] suggest adding constexpr when it is possible #115622

Open
@5chmidti

Description

@5chmidti

Add a check to suggest adding constexpr to variables and functions to the extent that each standard version allows. Using constexpr can, e.g., potentially uncover UB in code, as that is not permitted in a constexpr context.

I'm refactoring my prototype that ran successfully on the clang and clang-tools-extra targets (using a more restrictive mode than the standard permits) with working fixits. I need to finish the implementation, add more tests, and evaluate the check against some code-bases before posting the PR though.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions