boost-ext / te

C++17 Run-time Polymorphism (Type Erasure) library
451 stars 38 forks source link

Does not compile on certain versions of gcc and clang #34

Open pfeatherstone opened 2 years ago

pfeatherstone commented 2 years ago

This is the example program provided on the main page which showcases better inlining than vanilla inheritance. https://godbolt.org/z/9h9qf87n5 It fails to compile with certain versions of clang, e.g. 12, 11, 10, 9 and 8. And it fails to compile with certain version of gcc. I have no idea how to solve this. I think it has something to do with when templates are "evaluated". The library checks for type completeness and uses requires__ a lot, I imagine to ensure the type is complete at the point where the poly is compiled. Something like that. Maybe for some compilers requires__ isn't enough, so the type is incomplete, so it can't determine the number of methods registered via te::call and mappings::set. This could either be a compiler bug or the library is abusing a compiler mechanism that isn't guaranteed to work.

pfeatherstone commented 2 years ago

@krzysztof-jusiak @kris-jusiak Do you have an update on how to solve this ?