veselink1 / refl-cpp

Static reflection for C++17 (compile-time enumeration, attributes, proxies, overloads, template functions, metaprogramming).
https://veselink1.github.io/refl-cpp/md__introduction.html
MIT License
1.06k stars 77 forks source link

Error when compiling (type_info__<T*> has name defined as char[N] instead of const_string<N>) #1

Closed S4nderDevelopment closed 5 years ago

S4nderDevelopment commented 5 years ago

Hello,

When I try to compile my project in Visual Studio 2019 with the refl.hpp file, I get the following error:

'initializing': cannot convert from 'const char[2]' to 'const char[1]' on line 2154

I'm not an expert with the c++ preprocessor, so I don't know exactly where the problem is located in refl.hpp. Is this a bug? Or am I missing a preprocessor define to make it work? I am compiling with stdc++17.

Thanks,

Sander

veselink1 commented 5 years ago

Hello Sander,

That does seem to be a bug in the pointer specialization for the internal type_info__ template that holds the metadata for the type. It is a fragment from the older symbol representation that relied on char[N] instead of the newer util::const_string. I will look into it as soon a possible. The bug should also be present when reflecting on l-value and r-value references, as they share the same implementation.

S4nderDevelopment commented 5 years ago

Hello veselink1,

Thanks for your quick reply! I think I already found a solution. I placed a '2' between the square brackets of the name member for the internal type type_info__: image

Sander

veselink1 commented 5 years ago

Hello Sander,

Your solution is unfortunately only temporary. The lastest commit should have fixed the issue in full.

Diff: https://github.com/veselink1/refl-cpp/commit/9d8dd12b9ab4dc7ca7126faf980de15e617b19b0#diff-9d3b8a5a5ab7d2d06d496a5008d3d3acR2149