diff --git a/src/asm/lexer.cpp b/src/asm/lexer.cpp index 4111e7ad..082e9d4c 100644 --- a/src/asm/lexer.cpp +++ b/src/asm/lexer.cpp @@ -11,6 +11,7 @@ #include #include #include +#include // nothrow #include #include #include @@ -340,7 +341,7 @@ void LexerState::setFileAsNextState(std::string const &filePath, bool updateStat // Read the entire file for better performance // Ideally we'd use C++20 `auto ptr = std::make_shared(size)`, // but it has insufficient compiler support - auto ptr = std::shared_ptr(new char[size]); + auto ptr = std::shared_ptr(new (std::nothrow) char[size]); if (std::ifstream fs(path, std::ios::binary); !fs) { // LCOV_EXCL_START