Skip to content

Drop redundant typename (C++20 P0634) - #281

Merged
helly25 merged 1 commit into
mainfrom
clang_tidy_redundant_typename
Aug 9, 2026
Merged

Drop redundant typename (C++20 P0634)#281
helly25 merged 1 commit into
mainfrom
clang_tidy_redundant_typename

Conversation

@helly25

@helly25 helly25 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Clears all 33 readability-redundant-typename findings across 14 files.

What

C++20 (P0634R3, "Down with typename!") removed the requirement for typename in contexts where only a type can appear. These are all such contexts — alias declarations, member declarations, and requires-clause parameter lists:

-    using RawFirst = typename RawPair::first_type;
+    using RawFirst = RawPair::first_type;

-  typename Algo::StreamState state_;
+  Algo::StreamState state_;

-concept HasStreaming = requires(typename Algo::StreamState state, std::string_view data) {
+concept HasStreaming = requires(Algo::StreamState state, std::string_view data) {

The keyword stays valid where it was written, so this is a readability change, not a correctness one. The relaxed rules are C++20, which is this project's baseline (--cxxopt=-std=c++20), so the best-effort GCC build is unaffected — its support predates the baseline.

Method

Applied with clang-tidy's own fixes, exported per TU with --export-fixes and merged once via clang-apply-replacements, rather than running --fix in parallel across 81 TUs that share headers.

Unlike misc-const-correctness in #275 — where the auto-fix broke the build three different ways — this check's fixes are safe here. I verified that by reading the entire diff: all 66 changed lines are bare keyword removals, with no other edit of any kind.

Test

  • readability-redundant-typename reports zero across the affected files.
  • bazel test --config=clang //...109/109 pass.
  • pre-commit run -a green.

@helly25
helly25 force-pushed the clang_tidy_redundant_typename branch from d12d227 to 5d98158 Compare August 9, 2026 15:11
@helly25
helly25 enabled auto-merge (squash) August 9, 2026 16:01
@helly25
helly25 requested a review from Fab-Cat August 9, 2026 16:01
33 findings across 14 files, all in dependent-type contexts where C++20
no longer requires the keyword: alias declarations, member declarations,
and `requires`-clause parameter lists.

Applied with clang-tidy's own fixes, exported per TU and merged with
clang-apply-replacements rather than running --fix in parallel, so the
headers shared by many TUs could not be written concurrently. Unlike
misc-const-correctness, this check's fixes ARE safe here: every changed
line is a bare keyword removal, verified by reading the whole diff.

The keyword remains valid where written, so this is a readability change
rather than a correctness one - and the relaxed rules are C++20, which is
this project's baseline, so the GCC best-effort build is unaffected (its
support predates the baseline).

readability-redundant-typename now reports zero.
bazel test --config=clang //... - 109/109 pass.

Signed-off-by: helly25 <6420169+helly25@users.noreply.github.com>
@helly25
helly25 force-pushed the clang_tidy_redundant_typename branch from 1fbdb66 to 78ea3a7 Compare August 9, 2026 16:31
@helly25
helly25 merged commit 6c7e19b into main Aug 9, 2026
37 of 46 checks passed
@helly25
helly25 deleted the clang_tidy_redundant_typename branch August 9, 2026 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants