diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-07-13 08:37:11 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-07-13 08:37:11 +0000 |
commit | 218f47ff746b2216e949e79a287c034fd0bd8713 (patch) | |
tree | 1cf45c8170d72b09ee289c12dc87ddc03f458f6a | |
parent | 5291c3cec0dbe8ad1d8e7e67e93af2b1586d5400 (diff) |
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
-rw-r--r-- | lib/AST/StmtProfile.cpp | 9 | ||||
-rw-r--r-- | test/SemaTemplate/dependent-type-identity.cpp | 12 |
2 files changed, 18 insertions, 3 deletions
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 <bool w> S< S<w>::cond && 1 > N::foo() { } } + +namespace PR7460 { + template <typename T> + struct TemplateClass2 + { + enum { SIZE = 100 }; + static T member[SIZE]; + }; + + template <typename T> + T TemplateClass2<T>::member[TemplateClass2<T>::SIZE]; +} |