+2016-07-21 Jonathan Wakely <jwakely@redhat.com>
+
+ * testsuite/18_support/new_delete_placement.cc: Don't allocate (and
+ leak) memory for arguments to placement delete.
+ * testsuite/20_util/addressof/1.cc: Don't leak memory.
+ * testsuite/22_locale/locale/global_locale_objects/3.cc: Likewise.
+ * testsuite/23_containers/unordered_multimap/insert/55028-debug.cc:
+ Likewise.
+
2016-07-20 Jonathan Wakely <jwakely@redhat.com>
* doc/xml/manual/intro.xml: Document DR 2684 status.
// libstdc++/7286
void test01()
{
- void* pc = new char;
- void* pa = new char[10];
+ char c = 'c';
+ void* p = &c;
void* tmp = 0;
- operator delete(pc, tmp);
- operator delete[](pa, tmp);
+ operator delete(p, tmp);
+ operator delete[](p, tmp);
}
int main()
VERIFY( std::addressof(o2) == ao2 );
VERIFY( std::addressof(f1) == &f1 );
+
+ delete ao1;
+ delete ao2;
}
int main()
VERIFY( loc04 == global_orig );
}
- // 2: Not destroyed when out of scope, deliberately leaked.
+ // 2: Not destroyed when out of scope, deliberately "leaked".
+ const facet_type* ptr = 0;
{
{
{
VERIFY( counter == 0 );
{
- locale loc01(locale::classic(), new facet_type(1));
+ ptr = new facet_type(1);
+ locale loc01(locale::classic(), ptr);
VERIFY( counter == 1 );
global_orig = locale::global(loc01);
name = loc01.name();
}
VERIFY( counter == 1 );
+ // Clean up.
+ delete ptr;
+
// Restore global settings.
locale::global(global_orig);
}
// using MyMap = std::multimap<std::string, MyType *>; // works
using MyMap = std::unordered_multimap<std::string, MyType*>; // fails to link
MyMap m;
- m.insert(std::make_pair(std::string("blah"), new MyType));
+ m.insert(std::make_pair(std::string("blah"), (MyType*)nullptr));
}
int main()