I made a wandbox that captures my issue: https://wandbox.org/permlink/qAX6SL43BvERo32Z
Basically, as the tittle suggests. I am using CRTP, and my base / parent class constructor calls a child method using the standard way in CTRP.
BUT that child method uses it's own child classes's attributes, which if are of certain type, such as std::string, appear to cause runtime issues (Such as bad alloc on MSVC, and 'what(): basic_string::_M_create' / empty string on GCC).
Long story short, is this UB? If so exactly why?
Bonus points for anyone who can give suggestions for how to tackle this problem. Should / can I add an "Init" "virtual" CTRP method that the parent class calls to initialize the child variables? Should I just generally avoid CTRP calling child methods in the constructor?