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

Build error #53

Closed
egorpugin opened this issue Sep 15, 2020 · 0 comments
Closed

Build error #53

egorpugin opened this issue Sep 15, 2020 · 0 comments
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@egorpugin
Copy link

0.6.6 and master.
The latest clang, libstdc++ 10.2 (from fedora 32).

Code:

#include <magic_enum.hpp>
enum class BuildState
{
    NotStarted,
};
void f()
{
    auto state = BuildState::NotStarted;
    magic_enum::enum_name(state);
}

Error:

[sw.client.core-0.4.2]/src/sw/core/build.cpp
In file included from D:/dev/cppan2/client2/src/sw/core/build.cpp:1:
d:/temp/9/magic_enum/include\magic_enum.hpp:409:81: fatal error: instantiating fold expression with 257 arguments exceeded expression nesting limit of 256
  constexpr std::size_t count = ((valid[I] ? std::size_t{1} : std::size_t{0}) + ...);
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
d:/temp/9/magic_enum/include\magic_enum.hpp:428:10: note: in instantiation of function template specialization 'magic_enum::detail::values<BuildState, false, -128, 0, 1, 2, 3, 4, 5, 6,
      7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
      53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97,
      98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
      134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
      170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205,
      206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241,
      242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256>' requested here
  return values<E, IsFlags, reflected_min_v<E, IsFlags>>(std::make_index_sequence<range_size>{});
         ^
d:/temp/9/magic_enum/include\magic_enum.hpp:432:34: note: in instantiation of function template specialization 'magic_enum::detail::values<BuildState, false, int>' requested here
inline constexpr auto values_v = values<E, IsFlags>();
                                 ^
d:/temp/9/magic_enum/include\magic_enum.hpp:438:33: note: in instantiation of variable template specialization 'magic_enum::detail::values_v' requested here
inline constexpr auto count_v = values_v<E, IsFlags>.size();
                                ^
d:/temp/9/magic_enum/include\magic_enum.hpp:559:17: note: in instantiation of variable template specialization 'magic_enum::detail::count_v' requested here
  static_assert(count_v<D, false> > 0, "magic_enum requires enum implementation and valid max and min.");
                ^
d:/temp/9/magic_enum/include\magic_enum.hpp:571:1: note: in instantiation of template class 'magic_enum::detail::enable_if_enum<true, false, BuildState, std::basic_string_view<char,
      std::char_traits<char>>>' requested here
using enable_if_enum_t = typename enable_if_enum<std::is_enum_v<std::decay_t<T>>, false, T, R>::type;
^
d:/temp/9/magic_enum/include\magic_enum.hpp:682:69: note: in instantiation of template type alias 'enable_if_enum_t' requested here
[[nodiscard]] constexpr auto enum_name(E value) noexcept -> detail::enable_if_enum_t<E, string_view> {
                                                                    ^
D:/dev/cppan2/client2/src/sw/core/build.cpp:9:5: note: while substituting deduced template arguments into function template 'enum_name' [with E = BuildState]
    magic_enum::enum_name(state);
    ^
d:/temp/9/magic_enum/include\magic_enum.hpp:409:81: note: use -fbracket-depth=N to increase maximum nesting level
  constexpr std::size_t count = ((valid[I] ? std::size_t{1} : std::size_t{0}) + ...);
                                                                                ^
1 error generated.
Error code: 1

Adding -fbracket-depth=260 helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants