summaryrefslogtreecommitdiffstats
path: root/clang/lib
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
commit3c8a0cfa5bec96b8190ab2114eb38127b45a05f4 (patch)
treef45c8804df585007c8851b1c8df473398696e83a /clang/lib
parent6493d9c27e4a0b333bed434d312c29a5f85c19a2 (diff)
downloadbcm5719-llvm-3c8a0cfa5bec96b8190ab2114eb38127b45a05f4.tar.gz
bcm5719-llvm-3c8a0cfa5bec96b8190ab2114eb38127b45a05f4.zip
When a template-id expression refers to a member function template, turn it into an (implicit) member access expression. Fixes PR5220
llvm-svn: 84848
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index d9c53ebec63..c691cd93a0b 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud