From: Richard Smith Date: Thu, 29 Sep 2011 19:42:27 +0000 (+0000) Subject: PR11000: Fix crash on invalid. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1991b7139a92d73420336690a870f049e88cfad6;p=clang PR11000: Fix crash on invalid. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140802 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Parse/ParseCXXInlineMethods.cpp b/lib/Parse/ParseCXXInlineMethods.cpp index 0ca249fd1a..923a5587e6 100644 --- a/lib/Parse/ParseCXXInlineMethods.cpp +++ b/lib/Parse/ParseCXXInlineMethods.cpp @@ -453,7 +453,7 @@ void Parser::ParseLexedMemberInitializers(ParsingClass &Class) { } void Parser::ParseLexedMemberInitializer(LateParsedMemberInitializer &MI) { - if (MI.Field->isInvalidDecl()) + if (!MI.Field || MI.Field->isInvalidDecl()) return; // Append the current token at the end of the new token stream so that it diff --git a/test/Parser/PR11000.cpp b/test/Parser/PR11000.cpp new file mode 100644 index 0000000000..41c62060a4 --- /dev/null +++ b/test/Parser/PR11000.cpp @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -std=c++0x %s 2>&1 | FileCheck %s + +// PR11000: Don't crash. +class tuple<> +{ + template + tuple(allocator_arg_t, const _Alloc&) {} + +// CHECK: 6 errors generated.