Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The type in typeid(type) gets replaced by const std::type_info #522

Closed
Ukilele opened this issue Apr 5, 2023 · 2 comments
Closed

The type in typeid(type) gets replaced by const std::type_info #522

Ukilele opened this issue Apr 5, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@Ukilele
Copy link

Ukilele commented Apr 5, 2023

Hello Andreas,
cppinsights transpiles the typeid operator differently, depending on whether you use typeid( type ) or typeid( expression ). When using tyepid( type ), the source type gets replaced by const std::type_info.
It is not a big issue for me, but I suggest keeping the source type (in my example int), if possible.

Source:

#include <typeinfo>
std::type_info const& tiA = typeid(int);
std::type_info const& tiB = typeid(0);

Insight:

#include <typeinfo>
const std::type_info & tiA = typeid(const std::type_info); //<- Here I would suggest to keep "int"

const std::type_info & tiB = typeid(0);

Cheers and thanks a lot for this great tool!

@andreasfertig
Copy link
Owner

Hello @Ukilele,

thanks for reporting this! Looks like a bug. A fix is on its way.

Andreas

@andreasfertig andreasfertig added the bug Something isn't working label Apr 12, 2023
andreasfertig added a commit that referenced this issue Apr 12, 2023
Fixed #522: Keep the type of the `typeid` expression as written.
@Ukilele
Copy link
Author

Ukilele commented Apr 12, 2023

Thanks a lot for fixing it so quickly 🚀 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants