llvm / llvm/llvm-project

clang-tidy: modernize-use-using removes const and volatile qualifiers

Open
#158,406 2 comments 0 reactions 0 assignees View on GitHub
clang-tidy
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```cpp
typedef const int T;
typedef volatile int U;
```

```console
$ clang-tidy '--checks=-*,modernize-use-using' --fix a.cpp
2 warnings generated.
/tmp/a.cpp:1:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
1 | typedef const int T;
| ^~~~~~~~~~~~~~~~~~~
| using T = int
/tmp/a.cpp:2:1: warning: use 'using' instead of 'typedef' [modernize-use-using]
2 | typedef volatile int U;
| ^~~~~~~~~~~~~~~~~~~~~~
| using U = int
```

gives

```cpp
using T = int;
using U = int:
```

viz. CV-qualifiers are removed.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown a.cpp input and the modernize-use-using check command. Trace that check's handling of const and volatile typedefs; done means the suggested using declarations preserve both qualifiers and the command no longer removes them.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.