Skip to content

test_unordered_map.cpp: error: modification of 'ze_map' is not a constant expression; error: non-constant condition for static assertion #25

Description

@Randalphwa

Migrated from the original repository
Original issue: serge-sans-paille/frozen#163
Originally reported by: @barracuda156


Build failure on PowerPC macOS (g++-mp-12, C++20, -Werror):

test_unordered_map.cpp:22: error: modification of 'ze_map' is not a constant expression
   22 |   constexpr auto nocount = ze_map.count(3);

test_unordered_map.cpp:180: error: non-constant condition for static assertion
  180 |   static_assert(!ce.count(0), "");

test_unordered_map.cpp:181: error: non-constant condition for static assertion
  181 |   static_assert(ce.find(0) == ce.end(), "");

The root cause traced through the call chain leads to frozen::bits::seed_or_index(), which is apparently not a constant expression in this compiler/platform combination.

The same errors occur in test_unordered_set.cpp for ze_set.count() and similar static_assert checks.

Build environment:

  • macOS (PowerPC)
  • g++-mp-12
  • -std=gnu++20 -arch ppc -mmacosx-version-min=10.6 -Wall -Wextra -Wpedantic -Werror -Wshadow
  • frozen 1.1.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions