[PATCH] D111830: [clang] fix typo correction not looking for candidates in base classes.
Matheus Izvekov via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 15 15:35:30 PDT 2021
This revision was automatically updated to reflect the committed changes.
Closed by commit rG489561d46381: [clang] fix typo correction not looking for candidates in base classes. (authored by mizvekov).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D111830/new/
https://reviews.llvm.org/D111830
Files:
clang/lib/Sema/SemaExprMember.cpp
clang/test/CXX/drs/dr1xx.cpp
Index: clang/test/CXX/drs/dr1xx.cpp
===================================================================
--- clang/test/CXX/drs/dr1xx.cpp
+++ clang/test/CXX/drs/dr1xx.cpp
@@ -477,7 +477,7 @@
namespace dr141 { // dr141: yes
template<typename T> void f();
- template<typename T> struct S { int n; };
+ template<typename T> struct S { int n; }; // expected-note {{'::dr141::S<int>::n' declared here}}
struct A : S<int> {
template<typename T> void f();
template<typename T> struct S {};
@@ -485,7 +485,7 @@
struct B : S<int> {} b;
void g() {
a.f<int>();
- (void)a.S<int>::n; // expected-error {{no member named 'n'}}
+ (void)a.S<int>::n; // expected-error {{no member named 'n' in 'dr141::A::S<int>'; did you mean '::dr141::S<int>::n'?}}
#if __cplusplus < 201103L
// expected-error at -2 {{ambiguous}}
// expected-note at -11 {{lookup from the current scope}}
Index: clang/lib/Sema/SemaExprMember.cpp
===================================================================
--- clang/lib/Sema/SemaExprMember.cpp
+++ clang/lib/Sema/SemaExprMember.cpp
@@ -611,11 +611,10 @@
if (Record->containsDecl(ND))
return true;
- if (const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(Record)) {
+ if (const auto *RD = dyn_cast<CXXRecordDecl>(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<RecordType>(BS.getType().getTypePtrOrNull())) {
+ if (const auto *BSTy = BS.getType()->getAs<RecordType>()) {
if (BSTy->getDecl()->containsDecl(ND))
return true;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111830.380111.patch
Type: text/x-patch
Size: 1695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211015/1cba2ea3/attachment.bin>
More information about the cfe-commits
mailing list