mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-04 07:06:06 +00:00
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),
|
||||
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
|
||||
|
20
clang/test/SemaTemplate/instantiate-overloaded-arrow.cpp
Normal file
20
clang/test/SemaTemplate/instantiate-overloaded-arrow.cpp
Normal 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>();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user