chromium / subspace

A concept-centered standard library for C++20, enabling safer and more reliable products and a more modern feel for C++ code.; Also home of Subdoc the code-documentation generator.
https://suslib.cc
Apache License 2.0
89 stars 15 forks source link

FnRefs are a problem #352

Closed danakj closed 1 year ago

danakj commented 1 year ago

I finally wrote a memory bug in subdoc and it was painful and i miss not having memory bugs.

The bug was using a fnref as an lvalue, which then is left with a dangling ref to a lambda. This is forbidden in the docs but I forgot. We need that clang-tidy to prevent it, or change FnRefs to heap alloc and be more like DynFnRef (like DynError) to do type-erasure to the heap.

danakj commented 1 year ago

This is resolved, as FnRefs are gone. We now have the concepts and type-erased DynFn which can be referenced or boxed.

Fixed by https://github.com/chromium/subspace/pull/356