Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[clang-tidy] New check idea: readability-redundant-typename #158374

@localspook

Description

@localspook

Looking to see if there's interest in such a check.

P0634, adopted for C++20, makes disambiguating dependent types using typename unnecessary in a bunch of places. For example:

template <typename T>
using foo_t = /*typename*/ foo<T>::type;

template <typename T>
/*typename*/ T::bar f(/*typename*/ T::baz param) {
    ...
}

In fact, there are cases even before C++20 where typename is redundant, namely on nondependent types:

typename /* <--- always redundant */ std::make_unsigned<int>::type f();

Such a check would allow easy migration to the C++20 feature and relieve users of the need to remember rules for where typename is or is not necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions