File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,10 @@ void RedundantTypenameCheck::registerMatchers(MatchFinder *Finder) {
3333 varDecl (hasDeclContext (anyOf (namespaceDecl (), translationUnitDecl ())),
3434 unless (parmVarDecl ())),
3535 parmVarDecl (hasParent (expr (requiresExpr ()))),
36- parmVarDecl (hasParent (typeLoc (hasParent (
37- decl (anyOf (cxxMethodDecl (), hasParent (friendDecl ()),
38- functionDecl (has (nestedNameSpecifier ())))))))),
36+ parmVarDecl (hasParent (typeLoc (hasParent (decl (
37+ anyOf (cxxMethodDecl (), hasParent (friendDecl ()),
38+ functionDecl (has (nestedNameSpecifier ())),
39+ cxxDeductionGuideDecl (hasDeclContext (recordDecl ())))))))),
3940 // Match return types.
4041 functionDecl (unless (cxxConversionDecl ()))))),
4142 hasParent (expr (anyOf (cxxNamedCastExpr (), cxxNewExpr ()))));
Original file line number Diff line number Diff line change @@ -227,6 +227,17 @@ class A {
227227 // CHECK-MESSAGES-20: :[[@LINE-1]]:17: warning: redundant 'typename' [readability-redundant-typename]
228228 // CHECK-FIXES-20: friend void k(T::R) {}
229229
230+ template <typename >
231+ struct Nested {};
232+
233+ #if __cplusplus >= 201703L
234+ template <typename U>
235+ Nested (U, const typename U::R *, typename U::R = typename U::R ()) -> Nested<typename U::R>;
236+ // CHECK-MESSAGES-20: :[[@LINE-1]]:19: warning: redundant 'typename' [readability-redundant-typename]
237+ // CHECK-MESSAGES-20: :[[@LINE-2]]:36: warning: redundant 'typename' [readability-redundant-typename]
238+ // CHECK-FIXES-20: Nested(U, const U::R *, U::R = typename U::R()) -> Nested<typename U::R>;
239+ #endif
240+
230241 friend struct T ::R;
231242 using typename T::R;
232243 enum E1 : typename T::R {};
@@ -244,9 +255,7 @@ class A {
244255template <typename T, typename U = typename T::R>
245256// CHECK-MESSAGES-20: :[[@LINE-1]]:36: warning: redundant 'typename' [readability-redundant-typename]
246257// CHECK-FIXES-20: template <typename T, typename U = T::R>
247- A (T, typename T::R) -> A<typename T::R, typename NotDependent::R>;
248- // CHECK-MESSAGES-17: :[[@LINE-1]]:41: warning: redundant 'typename' [readability-redundant-typename]
249- // CHECK-FIXES-17: A(T, typename T::R) -> A<typename T::R, NotDependent::R>;
258+ A (T, typename T::R) -> A<typename T::R>;
250259
251260#endif
252261
You can’t perform that action at this time.
0 commit comments