Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize function-local static variables using "T& t = *new T" #3157

Open
wants to merge 2 commits into
base: v1.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions include/spdlog/details/console_globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ namespace details {
struct console_mutex {
using mutex_t = std::mutex;
static mutex_t &mutex() {
static mutex_t s_mutex;
static mutex_t& s_mutex = *new mutex_t;
return s_mutex;
}
};

struct console_nullmutex {
using mutex_t = null_mutex;
static mutex_t &mutex() {
static mutex_t s_mutex;
static mutex_t& s_mutex = *new mutex_t;
return s_mutex;
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/spdlog/details/registry-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ SPDLOG_INLINE void registry::set_levels(log_levels levels, level::level_enum *gl
}

SPDLOG_INLINE registry &registry::instance() {
static registry s_instance;
static registry& s_instance = *new registry;
return s_instance;
}

Expand Down