summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index 6351b7d115f..422398ebeb1 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -5991,8 +5991,10 @@ static ExprResult attemptRecovery(Sema &SemaRef,
if (auto *NNS = TC.getCorrectionSpecifier())
Record = NNS->getAsType()->getAsCXXRecordDecl();
if (!Record)
- Record = cast<CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
- R.setNamingClass(Record);
+ Record =
+ dyn_cast<CXXRecordDecl>(ND->getDeclContext()->getRedeclContext());
+ if (Record)
+ R.setNamingClass(Record);
// Detect and handle the case where the decl might be an implicit
// member.
OpenPOWER on IntegriCloud