diff --git a/clang/lib/Sema/SemaExprMember.cpp b/clang/lib/Sema/SemaExprMember.cpp --- a/clang/lib/Sema/SemaExprMember.cpp +++ b/clang/lib/Sema/SemaExprMember.cpp @@ -611,11 +611,10 @@ if (Record->containsDecl(ND)) return true; - if (const CXXRecordDecl *RD = dyn_cast(Record)) { + if (const auto *RD = dyn_cast(Record)) { // Accept candidates that occur in any of the current class' base classes. for (const auto &BS : RD->bases()) { - if (const RecordType *BSTy = - dyn_cast_or_null(BS.getType().getTypePtrOrNull())) { + if (const auto *BSTy = BS.getType()->getAs()) { if (BSTy->getDecl()->containsDecl(ND)) return true; } diff --git a/clang/test/CXX/drs/dr1xx.cpp b/clang/test/CXX/drs/dr1xx.cpp --- a/clang/test/CXX/drs/dr1xx.cpp +++ b/clang/test/CXX/drs/dr1xx.cpp @@ -477,7 +477,7 @@ namespace dr141 { // dr141: yes template void f(); - template struct S { int n; }; + template struct S { int n; }; // expected-note {{'::dr141::S::n' declared here}} struct A : S { template void f(); template struct S {}; @@ -485,7 +485,7 @@ struct B : S {} b; void g() { a.f(); - (void)a.S::n; // expected-error {{no member named 'n'}} + (void)a.S::n; // expected-error {{no member named 'n' in 'dr141::A::S'; did you mean '::dr141::S::n'?}} #if __cplusplus < 201103L // expected-error@-2 {{ambiguous}} // expected-note@-11 {{lookup from the current scope}}