https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110138
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Just use a stateful allocator and check that the correct state is propagated. See testsuite/21_strings/basic_string/allocator/char/operator_plus.cc which does exactly that.