From: Douglas Gregor Date: Tue, 13 Jul 2010 08:37:11 +0000 (+0000) Subject: When computing the canonical profile of a DeclRefExpr or MemberExpr, X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=218f47ff746b2216e949e79a287c034fd0bd8713;p=clang When computing the canonical profile of a DeclRefExpr or MemberExpr, don't include the nested-name-specifier or template arguments: they were only relevant when resolving the declaration. Fixes PR7460. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108235 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp index 2c6918677d..cff86a4e1c 100644 --- a/lib/AST/StmtProfile.cpp +++ b/lib/AST/StmtProfile.cpp @@ -211,9 +211,11 @@ void StmtProfiler::VisitExpr(Expr *S) { void StmtProfiler::VisitDeclRefExpr(DeclRefExpr *S) { VisitExpr(S); - VisitNestedNameSpecifier(S->getQualifier()); + if (!Canonical) + VisitNestedNameSpecifier(S->getQualifier()); VisitDecl(S->getDecl()); - VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); + if (!Canonical) + VisitTemplateArguments(S->getTemplateArgs(), S->getNumTemplateArgs()); } void StmtProfiler::VisitPredefinedExpr(PredefinedExpr *S) { @@ -307,7 +309,8 @@ void StmtProfiler::VisitCallExpr(CallExpr *S) { void StmtProfiler::VisitMemberExpr(MemberExpr *S) { VisitExpr(S); VisitDecl(S->getMemberDecl()); - VisitNestedNameSpecifier(S->getQualifier()); + if (!Canonical) + VisitNestedNameSpecifier(S->getQualifier()); ID.AddBoolean(S->isArrow()); } diff --git a/test/SemaTemplate/dependent-type-identity.cpp b/test/SemaTemplate/dependent-type-identity.cpp index feffdcf369..731013c863 100644 --- a/test/SemaTemplate/dependent-type-identity.cpp +++ b/test/SemaTemplate/dependent-type-identity.cpp @@ -86,3 +86,15 @@ namespace PR6851 { template S< S::cond && 1 > N::foo() { } } + +namespace PR7460 { + template + struct TemplateClass2 + { + enum { SIZE = 100 }; + static T member[SIZE]; + }; + + template + T TemplateClass2::member[TemplateClass2::SIZE]; +}