MSVC attemps to emit the full std::vector type because the class is exported and cannot fully instantiate it because the payload type is not copyable. Use a member reference instead so that the full type is only needed in the implementation.
Diff Detail
- Repository
- R865 Ruqola
- Lint
Lint Skipped - Unit
Unit Tests Skipped
Wow a patch by Till Adam, it feels like the old days again :-)
I remember the problem with MSVC instanciating templates fully, but RunningAnimatedImage is defined in the header so it has access to it, no? I don't follow the logic of "so that the full type is only needed in the implementation".
Would it help to disable copying of MessageDelegateHelperImage so that MSVC doesn't attempt to generate code that copies that vector? If the ref helps, I'm thinking this might be the problem...
src/widgets/room/delegate/messagedelegatehelperimage.cpp | ||
---|---|---|
41 ↗ | (On Diff #81175) | Doesn't this create a reference to a temporary? |
Yep, disabling the copyability of MessageDelegateHelperImage also helps, because the vector doesn't need to be copyable anymore. Better solution, indeed.
src/widgets/room/delegate/messagedelegatehelperimage.cpp | ||
---|---|---|
41 ↗ | (On Diff #81175) | Ah, right, because it uses the move ctor, right? |
src/widgets/room/delegate/messagedelegatehelperimage.cpp | ||
---|---|---|
41 ↗ | (On Diff #81175) | Hmm, no, because the member was a ref, and it was initialized with a default-constructed temporary here. But well, it didn't crash for you so I'm not 100% sure what was happening here. |