From 3b4d720f293f08a492d210b8fb4b3512c6b73124 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sun, 29 Mar 2015 14:35:39 +0000 Subject: [PATCH] [Parse] Don't crash on ~A::{ Found by clang-fuzz. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@233492 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Parse/ParseExprCXX.cpp | 2 +- test/Parser/cxx-class.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Parse/ParseExprCXX.cpp b/lib/Parse/ParseExprCXX.cpp index 1030072068..08606d03e7 100644 --- a/lib/Parse/ParseExprCXX.cpp +++ b/lib/Parse/ParseExprCXX.cpp @@ -2535,7 +2535,7 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext, 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; } diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index 215c941a46..f46e752bcb 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -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 -- 2.40.0