[cfe-commits] r144270 - in /cfe/trunk: lib/Parse/ParseCXXInlineMethods.cpp test/Parser/cxx-default-delete.cpp

Richard Smith richard-llvm at metafoo.co.uk
Thu Nov 10 01:08:44 PST 2011


Author: rsmith
Date: Thu Nov 10 03:08:44 2011
New Revision: 144270

URL: http://llvm.org/viewvc/llvm-project?rev=144270&view=rev
Log:
PR11148: Fix crash-on-invalid if an invalid member declaration is marked as
defaulted or deleted.

Modified:
    cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
    cfe/trunk/test/Parser/cxx-default-delete.cpp

Modified: cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp?rev=144270&r1=144269&r2=144270&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp (original)
+++ cfe/trunk/lib/Parse/ParseCXXInlineMethods.cpp Thu Nov 10 03:08:44 2011
@@ -66,6 +66,11 @@
   if (Tok.is(tok::equal)) {
     ConsumeToken();
 
+    if (!FnD) {
+      SkipUntil(tok::semi);
+      return 0;
+    }
+
     bool Delete = false;
     SourceLocation KWLoc;
     if (Tok.is(tok::kw_delete)) {

Modified: cfe/trunk/test/Parser/cxx-default-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-default-delete.cpp?rev=144270&r1=144269&r2=144270&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-default-delete.cpp (original)
+++ cfe/trunk/test/Parser/cxx-default-delete.cpp Thu Nov 10 03:08:44 2011
@@ -13,3 +13,7 @@
 };
 
 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}}
+};





More information about the cfe-commits mailing list