summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Parse/ParseExprCXX.cpp2
-rw-r--r--clang/test/Parser/cxx-class.cpp5
2 files changed, 7 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseExprCXX.cpp b/clang/lib/Parse/ParseExprCXX.cpp
index 506e13ac4ba..10ae450fe89 100644
--- a/clang/lib/Parse/ParseExprCXX.cpp
+++ b/clang/lib/Parse/ParseExprCXX.cpp
@@ -2521,6 +2521,8 @@ bool Parser::ParseUnqualifiedId(CXXScopeSpec &SS, bool EnteringContext,
}
if (ParseOptionalCXXScopeSpecifier(SS, ObjectType, EnteringContext))
return true;
+ if (SS.isNotEmpty())
+ ObjectType = ParsedType();
if (Tok.isNot(tok::identifier) || NextToken().is(tok::coloncolon) ||
SS.isInvalid()) {
Diag(TildeLoc, diag::err_destructor_tilde_scope);
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
index 077bd6f02ce..215c941a461 100644
--- a/clang/test/Parser/cxx-class.cpp
+++ b/clang/test/Parser/cxx-class.cpp
@@ -174,6 +174,11 @@ namespace DtorErrors {
int I; // expected-note {{declared here}}
~I::I() {} // expected-error {{'I' is not a class, namespace, or enumeration}} expected-error {{'~' in destructor name should be after nested name specifier}}
};
+
+ struct T {};
+ T t1 = t1.T::~T<int>; // expected-error {{destructor name 'T' does not refer to a template}} expected-error {{expected '(' for function-style cast or type construction}} expected-error {{expected expression}}
+ // Emit the same diagnostic as for the previous case, plus something about ~.
+ T t2 = t2.~T::T<int>; // expected-error {{'~' in destructor name should be after nested name specifier}} expected-error {{destructor name 'T' does not refer to a template}} expected-error {{expected '(' for function-style cast or type construction}} expected-error {{expected expression}}
}
namespace BadFriend {
OpenPOWER on IntegriCloud