diff --git a/.clang-tidy b/.clang-tidy index b0398498e..566fa5b22 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -19,7 +19,8 @@ Checks: > -readability-use-anyofallof, -readability-redundant-access-specifiers, -readability-convert-member-functions-to-static, - -cppcoreguidelines-avoid-const-or-ref-data-members + -cppcoreguidelines-avoid-const-or-ref-data-members, + -cppcoreguidelines-pro-bounds-constant-array-index CheckOptions: - key: misc-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic diff --git a/include/geode/basic/singleton.hpp b/include/geode/basic/singleton.hpp index cdef58d9b..87a5fee08 100644 --- a/include/geode/basic/singleton.hpp +++ b/include/geode/basic/singleton.hpp @@ -61,14 +61,13 @@ namespace geode { const auto& type = typeid( SingletonType ); const std::lock_guard< std::mutex > locking{ lock() }; - auto* singleton = - dynamic_cast< SingletonType* >( instance( type ) ); + auto* singleton = instance( type ); if( singleton == nullptr ) { singleton = new SingletonType{}; set_instance( type, singleton ); } - return *singleton; + return *static_cast< SingletonType* >( singleton ); } private: