--- title: Warning C26447 description: "Microsoft C++ Code Analysis warning C26447 for the C++ Core Guidelines case F.6." ms.date: 08/25/2020 f1_keywords: ["C26447", "DONT_THROW_IN_NOEXCEPT"] helpviewer_keywords: ["C26447"] --- # Warning C26447 > The function is declared `noexcept` but calls function *function_name* that may throw exceptions (f.6). C++ Core Guidelines:\ [F.6: If your function may not throw, declare it noexcept](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#f6-if-your-function-may-not-throw-declare-it-noexcept). ## Remarks This rule amends another rule, [C26440 DECLARE_NOEXCEPT](c26440.md), which tries to find functions that are good candidates to mark as **`noexcept`**. In this case, the idea is that once you mark some function as **`noexcept`**, it must keep its contract by not invoking other code that may throw exceptions. - The Microsoft C++ compiler already handles straightforward violations like **`throw`** statements in the function body (see [C4297](../error-messages/compiler-warnings/compiler-warning-level-1-c4297.md)). - The rule focuses only on function calls. It flags targets that aren't **`constexpr`** and that can potentially throw exceptions. In other words, they aren't marked explicitly as non-throwing by using **`noexcept`**, **`__declspec(nothrow)`**, or **throw()**. - The compiler-generated target functions are skipped to reduce noise since exception specifications aren't always provided by the compiler. - The checker also skips special kinds of target functions we expect you to implement as **`noexcept`**; this rule is enforced by [C26439 SPECIAL_NOEXCEPT](c26439.md). ## Example ```cpp #include #include #include std::vector collect(std::istream& is) noexcept { std::vector res; for (std::string s; is >> s;) // C26447, `operator bool()` can throw, std::string's allocator can throw res.push_back(s); // C26447, `push_back` can throw return res; } ``` You can fix these warnings by removing **`noexcept`** from the function signature. ## See also [C26440 DECLARE_NOEXCEPT](c26440.md)