]> granicus.if.org Git - clang/commitdiff
PR11148: Fix crash-on-invalid if an invalid member declaration is marked as
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 10 Nov 2011 09:08:44 +0000 (09:08 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 10 Nov 2011 09:08:44 +0000 (09:08 +0000)
defaulted or deleted.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144270 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseCXXInlineMethods.cpp
test/Parser/cxx-default-delete.cpp

index 65f7f56fe93d0566cc7f2d46177fe8ac1ccaaee5..2877628f262f68c8a5cbf8adf275d6bcb76f78c6 100644 (file)
@@ -66,6 +66,11 @@ Decl *Parser::ParseCXXInlineMethodDef(AccessSpecifier AS,
   if (Tok.is(tok::equal)) {
     ConsumeToken();
 
+    if (!FnD) {
+      SkipUntil(tok::semi);
+      return 0;
+    }
+
     bool Delete = false;
     SourceLocation KWLoc;
     if (Tok.is(tok::kw_delete)) {
index f34f6fb014f2b05cacf2bb5c2e17b0bf28560b80..9ace0acee89bf0b1fa57785d19358dd0b29c30b1 100644 (file)
@@ -13,3 +13,7 @@ struct foo {
 };
 
 void baz() = delete;
+
+struct quux {
+  int quux() = default; // expected-error{{constructor cannot have a return type}} expected-error {{member 'quux' has the same name as its class}}
+};