https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114488
--- Comment #2 from mauro russo <ing.russomauro at gmail dot com> --- If something is removed from sample code (e.g., b made bool instead of a shared_ptr, or some const is removed), the problem disappears.