Fix redefinition errors when compiling as module (regression fix) #439
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello,
This trivial pull request fixes type redefinition errors when compiling magic_enum as a module while the preprocessor variable MAGIC_ENUM_USE_STD_MODULE is defined.
Issue
Compiling magic_enum modules with the preprocessor variable MAGIC_ENUM_USE_STD_MODULE defined causes type redefinition errors in the Microsoft Compiler. This occurs because the header is #include'd on line 62 of magic_enum_format.hpp. This line should be wrapped in
#ifndef MAGIC_ENUM_USE_STD_MODULE/#endif.This regression was introduced in commit a0db691, on 2025-11-21.
Steps to Reproduce
Fix
On line 62 of magic_enum_format.hpp, change
to
Environment