Bug 410754

Summary: [check proposal] warn against unused template arguments
Product: [Developer tools] clazy Reporter: Jean-Michaël Celerier <jeanmichael.celerier>
Component: generalAssignee: Unassigned bugs mailing-list <unassigned-bugs>
Status: REPORTED ---    
Severity: wishlist CC: smartins
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

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.