Fix PR5488: special-case the overloaded arrow operator so that we don't try to

treat it as a unary operator.

llvm-svn: 88938
This commit is contained in:
Eli Friedman 2009-11-16 19:13:03 +00:00
parent b3b44ce433
commit f2f534d12a
2 changed files with 23 additions and 0 deletions

View File

@ -5390,6 +5390,9 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
return getSema().CreateBuiltinArraySubscriptExpr(move(First),
DRE->getLocStart(),
move(Second), OpLoc);
} else if (Op == OO_Arrow) {
// -> is never a builtin operation.
return SemaRef.BuildOverloadedArrowExpr(0, move(First), OpLoc);
} else if (SecondExpr == 0 || isPostIncDec) {
if (!FirstExpr->getType()->isOverloadableType()) {
// The argument is not of overloadable type, so try to create a

View File

@ -0,0 +1,20 @@
// RUN: clang-cc -fsyntax-only -verify %s
// PR5488
struct X {
int x;
};
struct Iter {
X* operator->();
};
template <typename T>
void Foo() {
(void)Iter()->x;
}
void Func() {
Foo<int>();
}