r284556 - Resolve exception specifications when selecting an overloaded operator.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 18 17:14:23 PDT 2016


Author: rsmith
Date: Tue Oct 18 19:14:23 2016
New Revision: 284556

URL: http://llvm.org/viewvc/llvm-project?rev=284556&view=rev
Log:
Resolve exception specifications when selecting an overloaded operator.

Modified:
    cfe/trunk/lib/Sema/SemaOverload.cpp
    cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp

Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=284556&r1=284555&r2=284556&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Tue Oct 18 19:14:23 2016
@@ -60,6 +60,8 @@ CreateFunctionRefExpr(Sema &S, FunctionD
   // 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)

Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp?rev=284556&r1=284555&r2=284556&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp (original)
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp Tue Oct 18 19:14:23 2016
@@ -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>()());
 }




More information about the cfe-commits mailing list