aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaTemplate.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-10-22 07:19:14 +0000
committerDouglas Gregor <dgregor@apple.com>2009-10-22 07:19:14 +0000
commita9e29aa4b1e5042a763240899d8b8cf1267c3ec5 (patch)
tree4a82fbafdfe6d7a9a2b611b3d0ebcbd23799fb68 /lib/Sema/SemaTemplate.cpp
parente961afbf3f5604b043773192de77effa207cbe8c (diff)
When a template-id expression refers to a member function template, turn it into an (implicit) member access expression. Fixes PR5220
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@84848 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaTemplate.cpp')
-rw-r--r--lib/Sema/SemaTemplate.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/Sema/SemaTemplate.cpp b/lib/Sema/SemaTemplate.cpp
index d9c53ebec6..c691cd93a0 100644
--- a/lib/Sema/SemaTemplate.cpp
+++ b/lib/Sema/SemaTemplate.cpp
@@ -1261,6 +1261,24 @@ Sema::OwningExprResult Sema::BuildTemplateIdExpr(TemplateName Template,
// template arguments that we have against the template name, if the template
// name refers to a single template. That's not a terribly common case,
// though.
+
+ // Cope with an implicit member access in a C++ non-static member function.
+ NamedDecl *D = Template.getAsTemplateDecl();
+ if (!D)
+ D = Template.getAsOverloadedFunctionDecl();
+
+ QualType ThisType, MemberType;
+ if (D && isImplicitMemberReference(/*FIXME:??*/0, D, TemplateNameLoc,
+ ThisType, MemberType)) {
+ Expr *This = new (Context) CXXThisExpr(SourceLocation(), ThisType);
+ return Owned(MemberExpr::Create(Context, This, true,
+ /*FIXME:*/0, /*FIXME:*/SourceRange(),
+ D, TemplateNameLoc, true,
+ LAngleLoc, TemplateArgs,
+ NumTemplateArgs, RAngleLoc,
+ Context.OverloadTy));
+ }
+
return Owned(TemplateIdRefExpr::Create(Context,
/*FIXME: New type?*/Context.OverloadTy,
/*FIXME: Necessary?*/0,