Skip to content

Commit 5999be0

Browse files
authored
[clang] fix RecursiveASTVisitor traversal from type to decl (#132551)
1 parent 2b69a49 commit 5999be0

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

clang/include/clang/AST/RecursiveASTVisitor.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,9 @@ DEF_TRAVERSE_TYPE(RValueReferenceType,
10051005

10061006
DEF_TRAVERSE_TYPE(MemberPointerType, {
10071007
TRY_TO(TraverseNestedNameSpecifier(T->getQualifier()));
1008-
TRY_TO(TraverseDecl(T->getMostRecentCXXRecordDecl()));
1008+
if (T->isSugared())
1009+
TRY_TO(TraverseType(
1010+
QualType(T->getMostRecentCXXRecordDecl()->getTypeForDecl(), 0)));
10091011
TRY_TO(TraverseType(T->getPointeeType()));
10101012
})
10111013

clang/test/SemaCXX/member-pointer.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,3 +344,14 @@ namespace GH132494 {
344344
};
345345
template struct A<E>; // expected-note {{requested here}}
346346
} // namespace GH132494
347+
348+
namespace GH132401 {
349+
template <typename Func> struct CallableHelper {
350+
static auto Resolve() -> Func;
351+
};
352+
struct QIODevice {
353+
void d_func() { (void)d_ptr; }
354+
int d_ptr;
355+
};
356+
template struct CallableHelper<void (QIODevice::*)()>;
357+
} // namespace GH132401

0 commit comments

Comments
 (0)