r210617 - PR19993: don't assert/crash if a static data member is initialized by '= delete; '.

Richard Smith richard-llvm at metafoo.co.uk
Tue Jun 10 17:49:52 PDT 2014


Author: rsmith
Date: Tue Jun 10 19:49:52 2014
New Revision: 210617

URL: http://llvm.org/viewvc/llvm-project?rev=210617&view=rev
Log:
PR19993: don't assert/crash if a static data member is initialized by '= delete;'.

Modified:
    cfe/trunk/lib/Parse/ParseDeclCXX.cpp
    cfe/trunk/test/Parser/cxx0x-member-initializers.cpp

Modified: cfe/trunk/lib/Parse/ParseDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDeclCXX.cpp?rev=210617&r1=210616&r2=210617&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDeclCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDeclCXX.cpp Tue Jun 10 19:49:52 2014
@@ -2466,7 +2466,7 @@ ExprResult Parser::ParseCXXMemberInitial
             << 1 /* delete */;
         else
           Diag(ConsumeToken(), diag::err_deleted_non_function);
-        return ExprResult();
+        return ExprError();
       }
     } else if (Tok.is(tok::kw_default)) {
       if (IsFunction)
@@ -2474,7 +2474,7 @@ ExprResult Parser::ParseCXXMemberInitial
           << 0 /* default */;
       else
         Diag(ConsumeToken(), diag::err_default_special_members);
-      return ExprResult();
+      return ExprError();
     }
 
   }

Modified: cfe/trunk/test/Parser/cxx0x-member-initializers.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx0x-member-initializers.cpp?rev=210617&r1=210616&r2=210617&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx0x-member-initializers.cpp (original)
+++ cfe/trunk/test/Parser/cxx0x-member-initializers.cpp Tue Jun 10 19:49:52 2014
@@ -37,3 +37,7 @@ struct A {
   bool d1 = T1<int, T1<int, int>>::V < 3, d2;
   T1<int, int()> e = T1<int, int()>();
 };
+
+struct PR19993 {
+  static int n = delete; // expected-error {{only functions can have deleted definitions}}
+};





More information about the cfe-commits mailing list