From 8564139c0ec56fe8f9e692294f7ae103b609dbcb Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Fri, 9 Aug 2013 23:37:05 +0000 Subject: [PATCH] Correctly profile CXXPseudoDestructorExprs. CXXPseudoDestructorExprs may not contain a type. PR16852. llvm-svn: 188123 --- clang/lib/AST/StmtProfile.cpp | 9 ++++++++- clang/test/SemaTemplate/destructor-template.cpp | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp index a626f68aa588..eb93c1df0e2f 100644 --- a/clang/lib/AST/StmtProfile.cpp +++ b/clang/lib/AST/StmtProfile.cpp @@ -910,7 +910,14 @@ StmtProfiler::VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *S) { VisitExpr(S); ID.AddBoolean(S->isArrow()); VisitNestedNameSpecifier(S->getQualifier()); - VisitType(S->getDestroyedType()); + ID.AddBoolean(S->getScopeTypeInfo() != 0); + if (S->getScopeTypeInfo()) + VisitType(S->getScopeTypeInfo()->getType()); + ID.AddBoolean(S->getDestroyedTypeInfo() != 0); + if (S->getDestroyedTypeInfo()) + VisitType(S->getDestroyedType()); + else + ID.AddPointer(S->getDestroyedTypeIdentifier()); } void StmtProfiler::VisitOverloadExpr(const OverloadExpr *S) { diff --git a/clang/test/SemaTemplate/destructor-template.cpp b/clang/test/SemaTemplate/destructor-template.cpp index 6806c24a84eb..4e1af9ad1f96 100644 --- a/clang/test/SemaTemplate/destructor-template.cpp +++ b/clang/test/SemaTemplate/destructor-template.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s template class s0 { @@ -76,3 +76,9 @@ namespace rdar13140795 { Marshal::gc(); } } + +namespace PR16852 { + template struct S { int a; T x; }; + template decltype(S().~S()) f(); // expected-note {{candidate template ignored: couldn't infer template argument 'T'}} + void g() { f(); } // expected-error {{no matching function for call to 'f'}} +}