diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2015-01-09 09:37:26 +0000 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2015-01-09 09:37:26 +0000 |
commit | 83d12ae2646c6b9db6df794c9510bb1747c3f780 (patch) | |
tree | 5edeb36f492303cf30843554c60c06d09d8ba3b5 /lib/Sema/SemaExprCXX.cpp | |
parent | a2f75da3f0d6d316bd8a494045044b10fc982bc2 (diff) |
Fix crash in typo correction while correcting enum within a struct in C
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@225513 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExprCXX.cpp')
-rw-r--r-- | lib/Sema/SemaExprCXX.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp index 6351b7d115..422398ebeb 100644 --- a/lib/Sema/SemaExprCXX.cpp +++ b/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. |