diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-07-05 16:13:20 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-07-05 16:13:20 +0000 |
commit | 9a30c9946e898e595eb71f23dc9a60303428998b (patch) | |
tree | 82786253a9cebf2aa831d861aa3764625d9a17fb /lib/Sema/SemaDeclCXX.cpp | |
parent | 16c3eaeea209487ce688215736f0660fc530c17d (diff) |
ActOnCXXConditionDeclaration should take into account that
ActOnDeclarator can return NULL. Fixes PR10270, from Hans Wennborg!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134416 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index ac51138b91..368fd9259e 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -8914,10 +8914,13 @@ DeclResult Sema::ActOnCXXConditionDeclaration(Scope *S, Declarator &D) { "Parser allowed 'typedef' as storage class of condition decl."); Decl *Dcl = ActOnDeclarator(S, D); + if (!Dcl) + return true; + if (isa<FunctionDecl>(Dcl)) { // The declarator shall not specify a function. Diag(Dcl->getLocation(), diag::err_invalid_use_of_function_type) << D.getSourceRange(); - return DeclResult(); + return true; } return Dcl; |