Implement template instantiation for member operator access.

llvm-svn: 80609
This commit is contained in:
Douglas Gregor 2009-08-31 20:00:26 +00:00
parent 522fbc4969
commit f14b46f9a8
2 changed files with 23 additions and 9 deletions

View File

@ -837,10 +837,10 @@ public:
OwningExprResult RebuildMemberExpr(ExprArg Base, SourceLocation OpLoc,
bool isArrow, SourceLocation MemberLoc,
NamedDecl *Member) {
return getSema().ActOnMemberReferenceExpr(/*Scope=*/0, move(Base), OpLoc,
return getSema().BuildMemberReferenceExpr(/*Scope=*/0, move(Base), OpLoc,
isArrow? tok::arrow : tok::period,
MemberLoc,
/*FIXME*/*Member->getIdentifier(),
Member->getDeclName(),
/*FIXME?*/Sema::DeclPtrTy::make((Decl*)0));
}
@ -1435,10 +1435,10 @@ public:
CXXScopeSpec SS;
SS.setRange(QualifierRange);
SS.setScopeRep(Qualifier);
return getSema().ActOnMemberReferenceExpr(/*Scope=*/0, move(Base), OpLoc,
return getSema().BuildMemberReferenceExpr(/*Scope=*/0, move(Base), OpLoc,
isArrow? tok::arrow : tok::period,
MemberLoc,
/*FIXME*/*Member->getIdentifier(),
Member->getDeclName(),
/*FIXME?*/Sema::DeclPtrTy::make((Decl*)0),
&SS);
}
@ -1459,12 +1459,10 @@ public:
if (Base.isInvalid())
return SemaRef.ExprError();
assert(Name.getAsIdentifierInfo() &&
"Cannot transform member references with non-identifier members");
Base = SemaRef.ActOnMemberReferenceExpr(/*Scope=*/0,
Base = SemaRef.BuildMemberReferenceExpr(/*Scope=*/0,
move(Base), OperatorLoc, OpKind,
MemberLoc,
*Name.getAsIdentifierInfo(),
MemberLoc,
Name,
/*FIXME?*/Sema::DeclPtrTy::make((Decl*)0));
SemaRef.ActOnCXXExitMemberScope(0, SS);
return move(Base);

View File

@ -130,3 +130,19 @@ struct X0 {
void test_X0(X0<int> x, IntegralConstant<int, sizeof(int)> ic) {
x.f(5,ic);
}
namespace N8 {
struct X {
X operator+(const X&) const;
};
template<typename T>
T test_plus(const T* xp, const T& x, const T& y) {
x.operator+(y);
return xp->operator+(y);
}
void test_test_plus(X x) {
test_plus(&x, x, x);
}
}