diff --git a/compiler-rt/lib/tsan/rtl/tsan_mman.h b/compiler-rt/lib/tsan/rtl/tsan_mman.h --- a/compiler-rt/lib/tsan/rtl/tsan_mman.h +++ b/compiler-rt/lib/tsan/rtl/tsan_mman.h @@ -51,9 +51,9 @@ void *Alloc(uptr sz); void FreeImpl(void *p); -template -T *New() { - return new (Alloc(sizeof(T))) T(); +template +T *New(Args &&...args) { + return new (Alloc(sizeof(T))) T(static_cast(args)...); } template diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.cpp @@ -101,7 +101,7 @@ CHECK("unable to mprotect" && 0); } } - return new (Alloc(sizeof(ThreadContext))) ThreadContext(tid); + return New(tid); } #if !SANITIZER_GO