File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed
Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,9 @@ void RedundantTypenameCheck::check(const MatchFinder::MatchResult &Result) {
4747 const SourceLocation ElaboratedKeywordLoc = [&] {
4848 if (const auto *NonDependentTypeLoc =
4949 Result.Nodes .getNodeAs <TypeLoc>(" nonDependentTypeLoc" )) {
50+ if (NonDependentTypeLoc->getType ()->isDependentType ())
51+ return SourceLocation ();
52+
5053 if (const auto TL = NonDependentTypeLoc->getAs <TypedefTypeLoc>())
5154 return TL.getElaboratedKeywordLoc ();
5255
@@ -59,8 +62,7 @@ void RedundantTypenameCheck::check(const MatchFinder::MatchResult &Result) {
5962
6063 if (const auto TL =
6164 NonDependentTypeLoc->getAs <TemplateSpecializationTypeLoc>())
62- if (!TL.getType ()->isDependentType ())
63- return TL.getElaboratedKeywordLoc ();
65+ return TL.getElaboratedKeywordLoc ();
6466 } else {
6567 TypeLoc InnermostTypeLoc =
6668 *Result.Nodes .getNodeAs <TypeLoc>(" dependentTypeLoc" );
Original file line number Diff line number Diff line change @@ -267,3 +267,27 @@ WHOLE_TYPE_IN_MACRO Macro2;
267267
268268#define WHOLE_DECLARATION_IN_MACRO typename NotDependent::R Macro3
269269WHOLE_DECLARATION_IN_MACRO;
270+
271+ template <typename T> struct Wrapper {};
272+ template <typename T>
273+ struct ClassWrapper {
274+ using R = T;
275+ Wrapper<R> f ();
276+ };
277+
278+ template <typename T>
279+ Wrapper<typename ClassWrapper<T>::R> ClassWrapper<T>::f() {
280+ return {};
281+ }
282+
283+ template <typename T> struct StructWrapper {};
284+ template <typename T>
285+ class ClassWithNestedStruct {
286+ struct Nested {};
287+ StructWrapper<Nested> f ();
288+ };
289+
290+ template <typename T>
291+ StructWrapper<typename ClassWithNestedStruct<T>::Nested> ClassWithNestedStruct<T>::f() {
292+ return {};
293+ }
You can’t perform that action at this time.
0 commit comments