summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--static-noexcept.cpp5
-rw-r--r--tests/extern-c-remarks.cpp6
2 files changed, 10 insertions, 1 deletions
diff --git a/static-noexcept.cpp b/static-noexcept.cpp
index 088ea61..5fc51b3 100644
--- a/static-noexcept.cpp
+++ b/static-noexcept.cpp
@@ -354,8 +354,11 @@ private:
if (stillImplicitlyNoexcept) {
provenNoexceptDefinitions.insert(fn);
+ // extern "C" functions are implicitly noexcept. we have checked any available definitions
+ // at this point, but we don't want to remark for extern "C".
if (!doStrictChecking &&
- !fnT->hasNoexceptExceptionSpec())
+ !fnT->hasNoexceptExceptionSpec()
+ && !fn->isInExternCContext())
diagnoseCouldBeNoexcept(fn);
}
}
diff --git a/tests/extern-c-remarks.cpp b/tests/extern-c-remarks.cpp
new file mode 100644
index 0000000..2b9e0a8
--- /dev/null
+++ b/tests/extern-c-remarks.cpp
@@ -0,0 +1,6 @@
+// args: -Rcandidates
+
+extern "C" {
+ static inline void t0() {} // expected-no-diagnostics
+}
+extern "C" inline void t1() {}