]> granicus.if.org Git - clang/commitdiff
Suppress nothrow/Exception spec conflict warning when we dont know the ES.
authorErich Keane <erich.keane@intel.com>
Fri, 31 May 2019 16:46:38 +0000 (16:46 +0000)
committerErich Keane <erich.keane@intel.com>
Fri, 31 May 2019 16:46:38 +0000 (16:46 +0000)
In any situation where the Exception Spec isn't clear, suppress the
warning to avoid false positives.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@362243 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaType.cpp
test/SemaCXX/nothrow-vs-exception-specs.cpp

index 43ac435a824983552894af0aadbadca51d6d6091..d473fb6c8f3dcac03c190c2a6f146a1678cba11a 100644 (file)
@@ -6976,18 +6976,18 @@ static bool handleFunctionTypeAttr(TypeProcessingState &state, ParsedAttr &attr,
       case EST_BasicNoexcept:
       case EST_NoexceptTrue:
       case EST_NoThrow:
-      case EST_Unparsed:
         // Exception spec doesn't conflict with nothrow, so don't warn.
-        // Unparsed is included in this, since method signatures aren't parsed
-        // until after the fact.
+        LLVM_FALLTHROUGH;
+      case EST_Unparsed:
+      case EST_Uninstantiated:
+      case EST_DependentNoexcept:
+      case EST_Unevaluated:
+        // We don't have enough information to properly determine if there is a
+        // conflict, so suppress the warning.
         break;
-
       case EST_Dynamic:
       case EST_MSAny:
       case EST_NoexceptFalse:
-      case EST_DependentNoexcept:
-      case EST_Unevaluated:
-      case EST_Uninstantiated:
         S.Diag(attr.getLoc(), diag::warn_nothrow_attribute_ignored);
         break;
       }
index 563f604067072b95f5745c04e41ecbddc6918753..78416d8c0b6e031384eeb881be2e069192fe0b33 100644 (file)
@@ -54,6 +54,9 @@ __declspec(nothrow) void foo5() noexcept(noexcept(foo2()));
 // expected-warning@+1{{'nothrow' attribute conflicts with exception specification; attribute ignored}}
 __declspec(nothrow) void foo6() noexcept(noexcept(foo3()));
 
+template<typename F>
+__declspec(nothrow) void foo7() noexcept(noexcept(F()));
+
 // FIXME: It would be nice to be able to warn on these, however at the time we
 // evaluate the nothrow, these have yet to be parsed, so the data is not yet
 // there.