Resolve exception specifications when selecting an overloaded operator.

llvm-svn: 284556
This commit is contained in:
Richard Smith 2016-10-19 00:14:23 +00:00
parent 87378bd21e
commit 5f4b388442
2 changed files with 4 additions and 0 deletions

View File

@ -60,6 +60,8 @@ CreateFunctionRefExpr(Sema &S, FunctionDecl *Fn, NamedDecl *FoundDecl,
// being used.
if (FoundDecl != Fn && S.DiagnoseUseOfDecl(Fn, Loc))
return ExprError();
if (auto *FPT = Fn->getType()->getAs<FunctionProtoType>())
S.ResolveExceptionSpec(Loc, FPT);
DeclRefExpr *DRE = new (S.Context) DeclRefExpr(Fn, false, Fn->getType(),
VK_LValue, Loc, LocInfo);
if (HadMultipleCandidates)

View File

@ -33,7 +33,9 @@ namespace NoexceptFunctionTypes {
template<typename T> struct A {
constexpr bool f() noexcept(true) { return true; }
constexpr bool g() { return f(); }
constexpr bool operator()() const noexcept(true) { return true; }
};
static_assert(A<int>().f());
static_assert(A<int>().g());
static_assert(A<int>()());
}