#!/usr/bin/env sh set -eu cxx=${CXX_HOST:-c++} build_dir=${1:-host-build} mkdir -p "$build_dir" flags="-std=c++17 -Wall -Wextra -Werror -pedantic -Iinclude" sanitizers="-fsanitize=address,undefined -fno-omit-frame-pointer" $cxx $flags $sanitizers tests/vector_host.cpp -o "$build_dir/vector_host" ASAN_OPTIONS=detect_leaks=1 "$build_dir/vector_host" if $cxx $flags -c tests/vector_copy_rejected.cpp \ -o "$build_dir/vector_copy_rejected.o" \ >"$build_dir/vector_copy_rejected.log" 2>&1; then echo "copying VectorV1 compiled successfully" >&2 exit 1 fi if ! grep -Eq "deleted|use of deleted" "$build_dir/vector_copy_rejected.log"; then echo "copy rejection failed for an unexpected reason" >&2 cat "$build_dir/vector_copy_rejected.log" >&2 exit 1 fi echo "PASS host: move-only VectorV1, self-move and destructor safety"