math::Vec2f Font::getLineVerticalBounds() const
{
FT_Face face = reinterpret_cast<FT_Face>(mFace);
return math::Vec2f{ static_cast<float>(face->size->metrics.descender) / 64.0f, static_cast<float>(face->size->metrics.ascender) / 64.0f };
}
See the "math::Vec2f" right after the return statement?
If it IS there, this works.
If it IS NOT there, a default initialized vector is returned (0,0) (or garbage that happens to be close to 0 idk) where something like (-9,3) is expected.
Here is the initializer_list constructor thingy:
template<class VecType, ui32 ComCnt>
template<typename T>
Vector<VecType, ComCnt>::Vector(std::initializer_list<T> values)
{
assert(values.size() <= ComCnt);
auto iter = values.begin();
for (ui32 i = 0; i < values.size(); ++i) //I checked that size is always 2
{
(*this)[i] = static_cast<VecType>(*(iter++));
}
}
In debug mode, that initializer_list contains garbage (claims to have 12 elements and all are rubbish)
In release mode its harder to debug.
AND the funny thing is, if I turn optimization off, it works just fine. Sure it STILL returns absolute garbage, but it works...?
Spent the whole day trying to figure out why my FPS indicator magically disappears in release mode with optimizations enabled >.<
Is it even legal to return the arguments wrapped in {} and then having the returned object construct itself from that? I just realized this works fine without the second piece of code being present. edit: I mean legal with the initializer_list based constructor