diff options
author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2021-07-27 16:11:17 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-27 16:11:17 -0300 |
commit | 5da97c57cdc2419176aca61b3f873a865da1dee5 (patch) | |
tree | bc69bb0b43be003b38fb626caf61720da73bef74 /src | |
parent | 2717e79c74cda0b211ea90a3b63b014003cf64d5 (diff) | |
parent | c27ddb44de04d171b992c679875d98bb51806822 (diff) |
Merge pull request #6744 from lioncash/exc
exception: Make constructors explicit
Diffstat (limited to 'src')
-rw-r--r-- | src/shader_recompiler/exception.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/shader_recompiler/exception.h b/src/shader_recompiler/exception.h index 337e7f0c8..277be8541 100644 --- a/src/shader_recompiler/exception.h +++ b/src/shader_recompiler/exception.h @@ -4,7 +4,7 @@ #pragma once -#include <stdexcept> +#include <exception> #include <string> #include <string_view> #include <utility> @@ -17,7 +17,7 @@ class Exception : public std::exception { public: explicit Exception(std::string message) noexcept : err_message{std::move(message)} {} - const char* what() const noexcept override { + [[nodiscard]] const char* what() const noexcept override { return err_message.c_str(); } @@ -36,21 +36,21 @@ private: class LogicError : public Exception { public: template <typename... Args> - LogicError(const char* message, Args&&... args) + explicit LogicError(const char* message, Args&&... args) : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} }; class RuntimeError : public Exception { public: template <typename... Args> - RuntimeError(const char* message, Args&&... args) + explicit RuntimeError(const char* message, Args&&... args) : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} }; class NotImplementedException : public Exception { public: template <typename... Args> - NotImplementedException(const char* message, Args&&... args) + explicit NotImplementedException(const char* message, Args&&... args) : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} { Append(" is not implemented"); } @@ -59,7 +59,7 @@ public: class InvalidArgument : public Exception { public: template <typename... Args> - InvalidArgument(const char* message, Args&&... args) + explicit InvalidArgument(const char* message, Args&&... args) : Exception{fmt::format(fmt::runtime(message), std::forward<Args>(args)...)} {} }; |