@@ -25,11 +25,11 @@
// 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()
@@ -41,6 +41,9 @@ void test01()
VERIFY( std::addressof(o2) == ao2 );
VERIFY( std::addressof(f1) == &f1 );
+
+ delete ao1;
+ delete ao2;
}
int main()
@@ -73,13 +73,15 @@ void test03()
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();
@@ -101,6 +103,9 @@ void test03()
}
VERIFY( counter == 1 );
+ // Clean up.
+ delete ptr;
+
// Restore global settings.
locale::global(global_orig);
}
@@ -30,7 +30,7 @@ void test()
// 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()