From: Eli Friedman Date: Fri, 9 Aug 2013 23:37:05 +0000 (+0000) Subject: Correctly profile CXXPseudoDestructorExprs. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ee138f6478e62f77e90418fd133ba8d637a9248a;p=clang Correctly profile CXXPseudoDestructorExprs. CXXPseudoDestructorExprs may not contain a type. PR16852. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@188123 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp index a626f68aa5..eb93c1df0e 100644 --- a/lib/AST/StmtProfile.cpp +++ b/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/test/SemaTemplate/destructor-template.cpp b/test/SemaTemplate/destructor-template.cpp index 6806c24a84..4e1af9ad1f 100644 --- a/test/SemaTemplate/destructor-template.cpp +++ b/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'}} +}