r233492 - [Parse] Don't crash on ~A::{

Benjamin Kramer benny.kra at googlemail.com
Sun Mar 29 07:35:40 PDT 2015


Author: d0k
Date: Sun Mar 29 09:35:39 2015
New Revision: 233492

URL: http://llvm.org/viewvc/llvm-project?rev=233492&view=rev
Log:
[Parse] Don't crash on ~A::{

Found by clang-fuzz.

Modified:
    cfe/trunk/lib/Parse/ParseExprCXX.cpp
    cfe/trunk/test/Parser/cxx-class.cpp

Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=233492&r1=233491&r2=233492&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Sun Mar 29 09:35:39 2015
@@ -2535,7 +2535,7 @@ bool Parser::ParseUnqualifiedId(CXXScope
       if (SS.isNotEmpty())
         ObjectType = ParsedType();
       if (Tok.isNot(tok::identifier) || NextToken().is(tok::coloncolon) ||
-          SS.isInvalid()) {
+          !SS.isSet()) {
         Diag(TildeLoc, diag::err_destructor_tilde_scope);
         return true;
       }

Modified: cfe/trunk/test/Parser/cxx-class.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-class.cpp?rev=233492&r1=233491&r2=233492&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-class.cpp (original)
+++ cfe/trunk/test/Parser/cxx-class.cpp Sun Mar 29 09:35:39 2015
@@ -159,6 +159,7 @@ namespace DtorErrors {
   ~D::D() throw(X) {} // expected-error {{'~' in destructor name should be after nested name specifier}}
 
   ~Undeclared::Undeclared() {} // expected-error {{use of undeclared identifier 'Undeclared'}} expected-error {{'~' in destructor name should be after nested name specifier}}
+  ~Undeclared:: {} // expected-error {{expected identifier}} expected-error {{'~' in destructor name should be after nested name specifier}}
 
   struct S {
     // For another struct's destructor, emit the same diagnostic like for





More information about the cfe-commits mailing list