diff --git a/src/butil/class_name.h b/src/butil/class_name.h index 48babf7930..29c91a9c48 100644 --- a/src/butil/class_name.h +++ b/src/butil/class_name.h @@ -30,7 +30,7 @@ namespace butil { std::string demangle(const char* name); -namespace detail { +namespace { template struct ClassNameHelper { static std::string name; }; template std::string ClassNameHelper::name = demangle(typeid(T).name()); } @@ -39,7 +39,7 @@ template std::string ClassNameHelper::name = demangle(typeid(T). template const std::string& class_name_str() { // We don't use static-variable-inside-function because before C++11 // local static variable is not guaranteed to be thread-safe. - return detail::ClassNameHelper::name; + return ClassNameHelper::name; } // Get name of class |T|, in const char*.