From https://bugs.llvm.org/show_bug.cgi?id=32002: On FreeBSD 10.3, the following program displays "123", but "0" is expected: #include <memory> #include <iostream> int main() { std::make_shared<int>(123); std::cout << *std::make_shared<int>(); return 0; } The second std::make_shared reuses the piece of memory of the first one. But it should initialize it to zero, as if "new (ptr) int()" is called, where ptr is the address of allocated memory.
A commit references this bug: Author: dim Date: Sat Feb 18 14:44:14 UTC 2017 New revision: 313916 URL: https://svnweb.freebsd.org/changeset/base/313916 Log: Pull in r242377 from upstream libc++ trunk (by Marshall Clow): Make sure that __libcpp_compressed_pair_imp default-constructs its' members, rather than value-initializing them. Fixes PR#24137 This ensures std::make_shared<>'s default constructor properly initializes to zero. Direct commit to stable/9 and stable/10, since stable/11 and head already have a newer version of libc++, including this fix. Reported by: martin.beran@kernun.cz PR: 217200 Changes: stable/10/contrib/libc++/include/memory stable/9/contrib/libc++/include/memory