diff --git a/test/boostTest.cpp b/test/boostTest.cpp index eb55ead89..5b45cc758 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -89,7 +89,10 @@ int registerTests( } else { - static vector> filenames; + // This must be a vector of unique_ptrs because Boost.Test keeps the equivalent of a string_view to the filename + // that is passed in. If the strings were stored directly in the vector, pointers/references to them would be + // invalidated on reallocation. + static vector> filenames; filenames.emplace_back(make_unique(_path.string())); _suite.add(make_test_case(