aboutsummaryrefslogtreecommitdiff
path: root/clang/test/Parser/cxx-class.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2015-02-02 05:33:50 +0000
committerNico Weber <nicolasweber@gmx.de>2015-02-02 05:33:50 +0000
commit7f8ec52067af9cfb9568faf7fdcf8b6ed29cf8c7 (patch)
tree3a96d6633575eb8e41891c197cf638ddf35b2bb1 /clang/test/Parser/cxx-class.cpp
parent16bbaf16397a91da98ebca9310e5a611265053c3 (diff)
downloadllvm-7f8ec52067af9cfb9568faf7fdcf8b6ed29cf8c7.zip
llvm-7f8ec52067af9cfb9568faf7fdcf8b6ed29cf8c7.tar.gz
llvm-7f8ec52067af9cfb9568faf7fdcf8b6ed29cf8c7.tar.bz2
Follow-up to r217302: Don't crash on ~A::A in a postfix expr suffix followed by '<'.
This used to crash, complaining "ObjectType and scope specifier cannot coexist": struct A { } b = b.~A::A <int>; The only other caller of ParseOptionalCXXScopeSpecifier() that passes in a non-empty ObjectType clears the ObjectType of the scope specifier comes back non-empty (see the tok::period case in Parser::ParsePostfixExpressionSuffix()), so do that here too. Found by SLi's bot. llvm-svn: 227781
Diffstat (limited to 'clang/test/Parser/cxx-class.cpp')
-rw-r--r--clang/test/Parser/cxx-class.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Parser/cxx-class.cpp b/clang/test/Parser/cxx-class.cpp
index 077bd6f..215c941 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 {