Neargye / magic_enum

Static reflection for enums (to string, from string, iteration) for modern C++, work with any enum type without any macro or boilerplate code
MIT License
4.99k stars 445 forks source link

Compilation issues when using the magic_enum-library in a CLI/C++-project #284

Closed Baardi closed 1 year ago

Baardi commented 1 year ago

Hey.

We've been using this library for a while, and it does it's job well. But we've ran into some issues when upgrading from v0.8 to v0.9.3.

I get the following errors: Skjermbilde 2023-06-28 165703-kopi

I get similar errors using enum_name. Note that the input parameter is a regular std::string. A simple reproduction case would be something like this:

bilde

It seems that the only real requirement to reproduce this is to try to compile it with a CLR-switch, as it compiles fine from a pure c++ project. I can link you an example project reproducing this, if necessary Is C++/CLI beyond the scope of what this library wants to support, or do you welcome changes that allows for it?

I'm asking considering it worked in v0.8, and because it is a useful tool for converting between C# and C++ enums (going by string instead of underlying value)

Neargye commented 1 year ago

Hi, it looks like some nuances of working __FUNCSIG__ on CLI/C++. I've never used it myself CLR, but if you could please give me an example where I can check.

Neargye commented 1 year ago

Could you test the latest master?

Baardi commented 1 year ago

Yes that worked. I guess you don't need the reproduction case anymore?

Neargye commented 1 year ago

Yes, an example is not needed, thanks. I downloaded CLR locally, to be honest, I did not fully understand the cause of the error, but this solution seems to work ok.

BartmanAbyss commented 1 year ago

Thanks for the fix. Just noticed the breakage last week.