]> granicus.if.org Git - clang/commitdiff
Resolve exception specifications when selecting an overloaded operator.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 19 Oct 2016 00:14:23 +0000 (00:14 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Wed, 19 Oct 2016 00:14:23 +0000 (00:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@284556 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaOverload.cpp
test/SemaCXX/constant-expression-cxx1z.cpp

index 6ed68a9b161a2a04be6f70e393098d13541a34ec..0c7ef74a248a577a12f06617ff28d7d030951744 100644 (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)
index 9aab9991032438865d836c427e7df69353b6cef5..a045234ff9e7e9e2c723a8a006d1daeaf9329669 100644 (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>()());
 }