You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Type matching issue in registry context introduced in entt 3.16.0 #1310
I've hit a very elusive bug in EnTT's type matching behavior. I believe it was introduced by the refactoring of entt::any in v3.16.0. It took me some time to pin down a MWE in Godbolt, but I finally got it:
Splitting it across 4 files was an attack on my sanity! 🙂
Is there a specific reason you did this, otherwise it wouldn't reproduce, or is it just for aesthetics?
I can't figure out if I should look at forced instantiations and the like, or if I can simplify the whole thing to debug it.
Let me know. Thanks.
I think the issue only happens when we have two different translation units, one TU where FooT<uint32_t> is explicitly instantiated (and all its methods are defined), and one TU where only the class definition is available (its methods are declared, but not defined). For some reason this is causing the search of the FooT<uint32_t> * pointer to fail in main.cpp, whereas it succeeds in foo.cpp.
I guess we can simplify the example into two different .cpp (no header...), but I couldn't reproduce it with a single translation unit.
So maybe it has something to do with types/functions being resolved before link time, which is when the duplicate instantiations would be removed without the extern template?
Activity
skypjack commentedon Jan 26, 2026
Splitting it across 4 files was an attack on my sanity! 🙂
Is there a specific reason you did this, otherwise it wouldn't reproduce, or is it just for aesthetics?
I can't figure out if I should look at forced instantiations and the like, or if I can simplify the whole thing to debug it.
Let me know. Thanks.
jdumas commentedon Jan 26, 2026
I think the issue only happens when we have two different translation units, one TU where
FooT<uint32_t>is explicitly instantiated (and all its methods are defined), and one TU where only the class definition is available (its methods are declared, but not defined). For some reason this is causing the search of theFooT<uint32_t> *pointer to fail inmain.cpp, whereas it succeeds infoo.cpp.I guess we can simplify the example into two different .cpp (no header...), but I couldn't reproduce it with a single translation unit.
timmyL17 commentedon Jan 27, 2026
It seems that adding
extern template class FooT<uint32_t>;tomain.cppavoids the error.https://godbolt.org/z/s3Gnj4c6x
So maybe it has something to do with types/functions being resolved before link time, which is when the duplicate instantiations would be removed without the
extern template?skypjack commentedon Jan 30, 2026
This is what puzzles me:
I'd expect the same problem in debugging. Really strange. Something to look into, definitely.
test: common class to mimic type hash mismatch - see #1310
test: try to mimic the issue in #1310
any: fallback for type hash mismatch cases - close #1310
skypjack commentedon Oct 23, 2026
Hello. Can you double check the submitted fix? The version on the
wipbranch should work fine and get you covered. Thanks. 🙏