MSAN and ASAN also replace new/delete which leads to a link error in these tests. Currently they are unsupported but I think it would be useful if these tests could run with sanitizers.
This patch creates a support header that consolidates the new/delete replacement functionality and checking.
When we are using sanitizers new and delete are no longer replaced and the checks always return true.
For avoidance of macros, how about something like this:
And then in the individual tests:
And then if we want to be even more fancy later on, the MemCounter objects could be set up to count only within a scope by allowing them to register with each other to listen for these events. That seems like it'd be beneficial for at least utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp, and possibly others.