skypjack / uvw

Header-only, event based, tiny and easy to use libuv wrapper in modern C++ - now available as also shared/static library!
MIT License
1.84k stars 209 forks source link

type_info always returning same value #261

Closed stefan-baranoff closed 2 years ago

stefan-baranoff commented 2 years ago

In trying to upgrade from libuv 1.40.0 and uvw 2.8.0 to libuv 1.43.0 and uvw 2.11.0 we ran into major breakage in some of our internal tests. We are building under gcc 9.3.1-2 (from devtoolset-9 on CentOS 7.9) but it seems __PRETTY_FUNCTION__ in type_info.hpp is always returning type as the function name, regardless of template parameters. As best I can tell __PRETTY_FUNCTION__ is being converted to __FUNCTION__. Forcing back to fake() appears to work, once corrected to introduce the proper template parameter in the call.

I'm not sufficiently well versed in the details of PRETTYFUNCTION__ to start troubleshooting this. It seems to work from simple unit tests within uvw just calling type<>() directly, but not within our application. The end result is error events are emitted to listen callbacks and close events are emitted to error callbacks and all kinds of messes ensue.

If you have suggestions on how to minimally reproduce this, I'm open to ideas. Every time I try, it works, which makes me think it has to do with compiling a complex application in some way.

skypjack commented 2 years ago

I'm sorry but I've no idea. I can look into it if you've a reproducible example. Otherwise, I can't help but throw at you random thoughts because, as you rightly noted, it works in uvw and only breaks when used in a project that I don't have access to. 🤷‍♂️ What compiler do you use to compile your project? What version? It might even be that simple at the end of the day. Maybe your compiler doesn't offer this feature or just offers a broken version of it.

stefan-baranoff commented 2 years ago

Mystery solved; I tracked it down to g3log and went to open a ticket there and wouldn't you know it... https://github.com/KjellKod/g3log/pull/424

Sorry for the noise!

skypjack commented 2 years ago

Oh, wow 😅 thanks for the quick turnaround.