diff options
author | David Majnemer <david.majnemer@gmail.com> | 2015-01-09 10:33:23 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2015-01-09 10:33:23 +0000 |
commit | 0fe3f4d731e7d99e5287391af4519ee4a32cba43 (patch) | |
tree | 403092aae35eb5ae1c61c28e8c92ac28b6caf107 /clang/lib/Sema/SemaDecl.cpp | |
parent | 85d0473650a694606126932eaf021ad7d4f1dc64 (diff) | |
download | bcm5719-llvm-0fe3f4d731e7d99e5287391af4519ee4a32cba43.tar.gz bcm5719-llvm-0fe3f4d731e7d99e5287391af4519ee4a32cba43.zip |
Sema: Don't crash when variable is redefined as a constexpr function
We have a diagnostic describing that constexpr changed in C++14 when
compiling in C++11 mode. While doing this, it examines the previous
declaration and assumes that it is a function. However it is possible,
in the context of error recovery, for this to not be the case.
llvm-svn: 225518
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 970b2ecd72c..46cd285f5e8 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -7885,7 +7885,7 @@ bool Sema::CheckFunctionDeclaration(Scope *S, FunctionDecl *NewFD, (MD->getTypeQualifiers() & Qualifiers::Const) == 0) { CXXMethodDecl *OldMD = nullptr; if (OldDecl) - OldMD = dyn_cast<CXXMethodDecl>(OldDecl->getAsFunction()); + OldMD = dyn_cast_or_null<CXXMethodDecl>(OldDecl->getAsFunction()); if (!OldMD || !OldMD->isStatic()) { const FunctionProtoType *FPT = MD->getType()->castAs<FunctionProtoType>(); |