Bug 410754 - [check proposal] warn against unused template arguments
Summary: [check proposal] warn against unused template arguments
Status: REPORTED
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-08-09 08:46 UTC by Jean-Michaël Celerier
Modified: 2019-09-01 13:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Michaël Celerier 2019-08-09 08:46:36 UTC
This case has cost me some long minutes staring at my screen while refactoring some code - you remove an argument to a template function (say u in template<...> void f(T t, U u)), but forget to remove "typename U" from the list of template arguments, which removes your function from the overload set or cause even worse things.

The idea for this check would be to look for trivial template arguments (e.g. strictly things such as `typename T` or `class T`, not non-type template arguments, not defaulted types, etc...) and emit a warning if they are not used anywhere in the function parameter list or body.