From 8e2a638d3c9c0af2e866d614a49f27bc8b9f8cf9 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Wed, 19 Oct 2016 00:14:23 +0000 Subject: [PATCH] Resolve exception specifications when selecting an overloaded operator. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284556 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaOverload.cpp | 2 ++ test/SemaCXX/constant-expression-cxx1z.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/lib/Sema/SemaOverload.cpp b/lib/Sema/SemaOverload.cpp index 6ed68a9b16..0c7ef74a24 100644 --- a/lib/Sema/SemaOverload.cpp +++ b/lib/Sema/SemaOverload.cpp @@ -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()) + S.ResolveExceptionSpec(Loc, FPT); DeclRefExpr *DRE = new (S.Context) DeclRefExpr(Fn, false, Fn->getType(), VK_LValue, Loc, LocInfo); if (HadMultipleCandidates) diff --git a/test/SemaCXX/constant-expression-cxx1z.cpp b/test/SemaCXX/constant-expression-cxx1z.cpp index 9aab999103..a045234ff9 100644 --- a/test/SemaCXX/constant-expression-cxx1z.cpp +++ b/test/SemaCXX/constant-expression-cxx1z.cpp @@ -33,7 +33,9 @@ namespace NoexceptFunctionTypes { template 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().f()); static_assert(A().g()); + static_assert(A()()); } -- 2.40.0