forked from OSchip/llvm-project
Fix a crasher involving template instantiation of non-dependent
expressions making use of an overloaded operator. Thanks for the test case, Anders! llvm-svn: 80679
This commit is contained in:
parent
6cdf83c192
commit
32e2c8472e
|
@ -752,8 +752,10 @@ OverloadIterator::OverloadIterator(NamedDecl *ND) : D(0) {
|
|||
if (isa<FunctionDecl>(ND) || isa<FunctionTemplateDecl>(ND))
|
||||
D = ND;
|
||||
else if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(ND)) {
|
||||
D = ND;
|
||||
Iter = Ovl->function_begin();
|
||||
if (Ovl->size() != 0) {
|
||||
D = ND;
|
||||
Iter = Ovl->function_begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4525,16 +4525,12 @@ TreeTransform<Derived>::RebuildCXXOperatorCallExpr(OverloadedOperatorKind Op,
|
|||
// used during overload resolution.
|
||||
Sema::FunctionSet Functions;
|
||||
|
||||
DeclRefExpr *DRE = cast<DeclRefExpr>((Expr *)Callee.get());
|
||||
OverloadedFunctionDecl *Overloads
|
||||
= cast<OverloadedFunctionDecl>(DRE->getDecl());
|
||||
DeclRefExpr *DRE
|
||||
= cast<DeclRefExpr>(((Expr *)Callee.get())->IgnoreParenCasts());
|
||||
|
||||
// FIXME: Do we have to check
|
||||
// IsAcceptableNonMemberOperatorCandidate for each of these?
|
||||
for (OverloadedFunctionDecl::function_iterator
|
||||
F = Overloads->function_begin(),
|
||||
FEnd = Overloads->function_end();
|
||||
F != FEnd; ++F)
|
||||
for (OverloadIterator F(DRE->getDecl()), FEnd; F != FEnd; ++F)
|
||||
Functions.insert(*F);
|
||||
|
||||
// Add any functions found via argument-dependent lookup.
|
||||
|
|
|
@ -146,3 +146,17 @@ namespace N8 {
|
|||
test_plus(&x, x, x);
|
||||
}
|
||||
}
|
||||
|
||||
namespace N9 {
|
||||
struct A {
|
||||
bool operator==(int value);
|
||||
};
|
||||
|
||||
template<typename T> struct B {
|
||||
bool f(A a) {
|
||||
return a == 1;
|
||||
}
|
||||
};
|
||||
|
||||
template struct B<int>;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue