-
Notifications
You must be signed in to change notification settings - Fork 531
Description
Hello,
I have a compilation issue with magic_enum::enum_cast using a string as input with the compiler clang 12.0.1. More precisely I am using enum_cast to cast a string into an enum into 2 locations in my code, one was compiling fine but not the others. It took me a while to discover the cause.
We are using the library g3log for our logs and I realised that if the header g3log.hpp was included before magic_enum.hpp, the call to emum_cast does not compile.
More specifically, this is the piece of code causing the issue with magic_enum:
#if !defined(__PRETTY_FUNCTION__)
#define __PRETTY_FUNCTION__ __FUNCTION__
#endif
You can see a reproductible code here: https://godbolt.org/z/dEnf1Gq56.
I am not very familiar with PRETTY_FUNCTION but I would have expected it to be defined with clang. It seems not to be the case for some reason so it is defined with FUNCTION and I'm guessing that magic_enum has a problem with that. At first glance it does not seem too crazy for g3log to define PRETTY_FUNCTION if it does not exist.
And if it is not defined, why magic_enum compiles successfully since magic_enum makes use of it?
I am not sure who is at fault here, g3log or magic_enum, but there are definitely not working together with clang. What is your take on that? Thank you in advance for your help.