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:
parent
b3b44ce433
commit
f2f534d12a
|
@ -5390,6 +5390,9 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
|
||||||
return getSema().CreateBuiltinArraySubscriptExpr(move(First),
|
return getSema().CreateBuiltinArraySubscriptExpr(move(First),
|
||||||
DRE->getLocStart(),
|
DRE->getLocStart(),
|
||||||
move(Second), OpLoc);
|
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) {
|
} else if (SecondExpr == 0 || isPostIncDec) {
|
||||||
if (!FirstExpr->getType()->isOverloadableType()) {
|
if (!FirstExpr->getType()->isOverloadableType()) {
|
||||||
// The argument is not of overloadable type, so try to create a
|
// The argument is not of overloadable type, so try to create a
|
||||||
|
|
|
@ -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>();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue