]> granicus.if.org Git - clang/commitdiff
PR11000: Fix crash on invalid.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 29 Sep 2011 19:42:27 +0000 (19:42 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 29 Sep 2011 19:42:27 +0000 (19:42 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140802 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseCXXInlineMethods.cpp
test/Parser/PR11000.cpp [new file with mode: 0644]

index 0ca249fd1a979fb8a56b664552aefb5957685bf5..923a5587e6c31a5d34dcbff514775db2e35cfba4 100644 (file)
@@ -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 (file)
index 0000000..41c6206
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++0x %s 2>&1 | FileCheck %s
+
+// PR11000: Don't crash.
+class tuple<>
+{
+    template <class _Alloc>
+        tuple(allocator_arg_t, const _Alloc&) {}
+
+// CHECK: 6 errors generated.