From 4cba5de0e546bfdc947a3560d8aa953e98c04d32 Mon Sep 17 00:00:00 2001 From: Andre Kuhlenschmidt Date: Tue, 10 Jun 2025 08:11:53 -0700 Subject: [PATCH] return line of PR to original implementation --- flang/include/flang/Common/enum-class.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/flang/include/flang/Common/enum-class.h b/flang/include/flang/Common/enum-class.h index 0635a0c85be05..9f9134ee3ff7a 100644 --- a/flang/include/flang/Common/enum-class.h +++ b/flang/include/flang/Common/enum-class.h @@ -62,14 +62,13 @@ constexpr std::array EnumNames(const char *p) { enum class NAME { __VA_ARGS__ }; \ [[maybe_unused]] static constexpr std::size_t NAME##_enumSize{ \ ::Fortran::common::CountEnumNames(#__VA_ARGS__)}; \ - [[maybe_unused]] static constexpr std::array NAME##_names{ \ - ::Fortran::common::EnumNames(#__VA_ARGS__)}; \ [[maybe_unused]] static inline std::size_t EnumToInt(NAME e) { \ return static_cast(e); \ } \ [[maybe_unused]] static inline std::string_view EnumToString(NAME e) { \ - return NAME##_names[static_cast(e)]; \ + static const constexpr auto names{ \ + ::Fortran::common::EnumNames(#__VA_ARGS__)}; \ + return names[static_cast(e)]; \ } \ [[maybe_unused]] inline void ForEach##NAME(std::function f) { \ for (std::size_t i{0}; i < NAME##_enumSize; ++i) { \